diff --git a/apis/openapi-spec/pipeline-service.yaml b/apis/openapi-spec/pipeline-service.yaml
index 6d945b88..3de5d056 100644
--- a/apis/openapi-spec/pipeline-service.yaml
+++ b/apis/openapi-spec/pipeline-service.yaml
@@ -156,12 +156,15 @@ paths:
$ref: "#/components/schemas/PipelineExecuteRequest"
required: true
responses:
- "203":
- description: Non-Authoritative Information
+ "202":
+ description: Accepted
content:
application/json:
schema:
- $ref: "#/components/schemas/PipelineBuild"
+ type: object
+ additionalProperties:
+ type: string
+ format: uuid
security:
- bearerAuth: []
/api/v1/stage/build/logs/{stageBuildId}:
diff --git a/docker-compose.yml b/docker-compose.yml
index fdc4bd1a..0dd98ccb 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -67,6 +67,19 @@ services:
- "8016:8016"
networks:
- app
+ rabbitmq:
+ image: rabbitmq:3-management
+ container_name: rabbitmq
+ ports:
+ - "5672:5672"
+ - "15672:15672"
+ networks:
+ - app
+ healthcheck:
+ test: ["CMD", "rabbitmq-diagnostics", "ping"]
+ interval: 10s
+ timeout: 5s
+ retries: 5
pipeline-app:
image: pipeline-app
container_name: pipeline-app
@@ -79,6 +92,7 @@ services:
AUTH_PORT: 8080
OTEL_SERVICE_NAME: pipeline-app
FEATURE_PROVIDER_URI: http://flagd:8016
+ RABBITMQ_URL: amqp://guest:guest@rabbitmq:5672
ports:
- "8080:8080"
volumes:
@@ -92,4 +106,6 @@ services:
auth-service:
condition: service_healthy
flagd:
- condition: service_started
\ No newline at end of file
+ condition: service_started
+ rabbitmq:
+ condition: service_healthy
\ No newline at end of file
diff --git a/flags/feature-flags.json b/flags/feature-flags.json
index 554b7bc7..0a9ba902 100644
--- a/flags/feature-flags.json
+++ b/flags/feature-flags.json
@@ -8,6 +8,14 @@
"off": false
},
"defaultVariant": "off"
+ },
+ "ENABLE_NEW_ARCHITECTURE": {
+ "state": "ENABLED",
+ "variants": {
+ "on": true,
+ "off": false
+ },
+ "defaultVariant": "off"
}
}
}
diff --git a/pipeline/pom.xml b/pipeline/pom.xml
index efc9ba78..927521fd 100644
--- a/pipeline/pom.xml
+++ b/pipeline/pom.xml
@@ -150,6 +150,11 @@
0.0.2
+
+ org.springframework.boot
+ spring-boot-starter-amqp
+
+
diff --git a/pipeline/src/main/java/com/autobuild/pipeline/configuration/FeatureFlag.java b/pipeline/src/main/java/com/autobuild/pipeline/configuration/FeatureFlag.java
index 61fdca40..a258ed4f 100644
--- a/pipeline/src/main/java/com/autobuild/pipeline/configuration/FeatureFlag.java
+++ b/pipeline/src/main/java/com/autobuild/pipeline/configuration/FeatureFlag.java
@@ -2,7 +2,8 @@
/** Enum of all feature flag keys used in this application. */
public enum FeatureFlag {
- ENABLE_EDIT_PIPELINE("ENABLE_EDIT_PIPELINE");
+ ENABLE_EDIT_PIPELINE("ENABLE_EDIT_PIPELINE"),
+ ENABLE_NEW_ARCHITECTURE("ENABLE_NEW_ARCHITECTURE");
private final String key;
diff --git a/pipeline/src/main/java/com/autobuild/pipeline/configuration/MessagingConfig.java b/pipeline/src/main/java/com/autobuild/pipeline/configuration/MessagingConfig.java
new file mode 100644
index 00000000..0c11a454
--- /dev/null
+++ b/pipeline/src/main/java/com/autobuild/pipeline/configuration/MessagingConfig.java
@@ -0,0 +1,35 @@
+package com.autobuild.pipeline.configuration;
+
+import org.springframework.amqp.core.Queue;
+import org.springframework.amqp.rabbit.connection.ConnectionFactory;
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
+import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * Message queue configuration.
+ */
+@Configuration
+public class MessagingConfig {
+
+ /** Name of the queue used to dispatch pipeline build execution requests. */
+ public static final String PIPELINE_BUILD_REQUEST_QUEUE = "pipeline-build-request-queue";
+
+ @Bean
+ public Queue pipelineBuildQueue() {
+ return new Queue(PIPELINE_BUILD_REQUEST_QUEUE, true);
+ }
+
+ @Bean
+ public Jackson2JsonMessageConverter messageConverter() {
+ return new Jackson2JsonMessageConverter();
+ }
+
+ @Bean
+ public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory) {
+ RabbitTemplate template = new RabbitTemplate(connectionFactory);
+ template.setMessageConverter(messageConverter());
+ return template;
+ }
+}
diff --git a/pipeline/src/main/java/com/autobuild/pipeline/executor/controller/PipelineExecutorController.java b/pipeline/src/main/java/com/autobuild/pipeline/executor/controller/PipelineExecutorController.java
index a02140f4..c4f91122 100644
--- a/pipeline/src/main/java/com/autobuild/pipeline/executor/controller/PipelineExecutorController.java
+++ b/pipeline/src/main/java/com/autobuild/pipeline/executor/controller/PipelineExecutorController.java
@@ -1,16 +1,16 @@
package com.autobuild.pipeline.executor.controller;
-import java.io.IOException;
+import java.util.Map;
+import java.util.UUID;
-import org.springframework.http.MediaType;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
-import com.autobuild.pipeline.executor.dto.PipelineBuildDTO;
import com.autobuild.pipeline.executor.dto.PipelineExecuteRequest;
import com.autobuild.pipeline.executor.service.PipelineExecutorService;
@@ -24,8 +24,6 @@
/**
* Controller for executing a pipeline.
- *
- * @author Suvabrata Chowdhury
*/
@Tag(name = "Pipeline")
@SecurityScheme(
@@ -43,12 +41,10 @@ public class PipelineExecutorController {
@Autowired
private PipelineExecutorService service;
- @Operation(summary = "Execute a pipeline", responses = @ApiResponse(responseCode = "203"))
+ @Operation(summary = "Execute a pipeline", responses = @ApiResponse(responseCode = "202"))
@PostMapping(value = "/pipeline", produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity executePipeline(@RequestBody @Valid PipelineExecuteRequest request)
- throws IOException {
- PipelineBuildDTO build = service.executePipeline(request);
-
- return ResponseEntity.accepted().body(build);
+ public ResponseEntity