From e4dd54e0b7475a11b2707c3b2d4a2fdf49331494 Mon Sep 17 00:00:00 2001 From: Baibhab23 Date: Wed, 18 Nov 2026 23:43:58 +0530 Subject: [PATCH 1/3] Updated Docker configuration to support OpenTelemetry integration --- .../docker-compose-monitoring-integration.yml | 5 +++++ pipeline/Dockerfile | 17 ++++++++++++++--- pipeline/entrypoint.sh | 6 ++++++ 3 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 pipeline/entrypoint.sh diff --git a/monitoring/docker-compose-monitoring-integration.yml b/monitoring/docker-compose-monitoring-integration.yml index be25dd17..335b7cb3 100644 --- a/monitoring/docker-compose-monitoring-integration.yml +++ b/monitoring/docker-compose-monitoring-integration.yml @@ -15,6 +15,11 @@ services: condition: service_started pipeline-app: + build: + context: . + dockerfile: pipeline/Dockerfile + args: + ENABLE_OTEL: "true" environment: OTEL_EXPORTER_OTLP_ENDPOINT: http://alloy:4317 OTEL_EXPORTER_OTLP_PROTOCOL: grpc diff --git a/pipeline/Dockerfile b/pipeline/Dockerfile index d53c01f7..dac4337a 100644 --- a/pipeline/Dockerfile +++ b/pipeline/Dockerfile @@ -2,18 +2,29 @@ # Build stage # FROM maven:3.9.6-eclipse-temurin-17 AS build +ARG ENABLE_OTEL=false WORKDIR /home/app COPY pipeline/pom.xml . COPY pipeline/src ./src COPY apis/protobuf /home/apis/protobuf -RUN mvn clean package -DskipTests -Pmonitoring +RUN if [ "$ENABLE_OTEL" = "true" ]; then \ + mvn clean package -DskipTests -Pmonitoring; \ + else \ + mvn clean package -DskipTests; \ + fi # # Runtime stage # FROM eclipse-temurin:17-jdk-jammy +ARG ENABLE_OTEL=false WORKDIR /app COPY --from=build /home/app/target/pipeline*.jar app.jar -COPY --from=build /home/app/target/agents/opentelemetry-javaagent.jar otel-agent.jar +RUN --mount=type=bind,from=build,source=/home/app/target,target=/build-output \ + if [ "$ENABLE_OTEL" = "true" ] && [ -f /build-output/agents/opentelemetry-javaagent.jar ]; then \ + cp /build-output/agents/opentelemetry-javaagent.jar /app/otel-agent.jar; \ + fi +COPY pipeline/entrypoint.sh /app/entrypoint.sh +RUN chmod +x /app/entrypoint.sh EXPOSE 8080 -ENTRYPOINT ["java", "-javaagent:otel-agent.jar", "-jar", "app.jar"] +ENTRYPOINT ["/app/entrypoint.sh"] diff --git a/pipeline/entrypoint.sh b/pipeline/entrypoint.sh new file mode 100644 index 00000000..0bbd51f6 --- /dev/null +++ b/pipeline/entrypoint.sh @@ -0,0 +1,6 @@ +#!/bin/sh +if [ -f /app/otel-agent.jar ]; then + exec java -javaagent:/app/otel-agent.jar -jar /app/app.jar "$@" +else + exec java -jar /app/app.jar "$@" +fi From 201d497c0929d22ec0ed48f5d4200db670548858 Mon Sep 17 00:00:00 2001 From: Suvabrata Chowdhury <114484620+SuvabrataChowdhury@users.noreply.github.com> Date: Thu, 19 Nov 2026 09:46:34 +0530 Subject: [PATCH 2/3] Chore: Sqlite localdb (#276) * sqlite profile * .db files with service name for uniformity * revert unnecessary changes * integration test fix with correct application properties --- pipeline/.gitignore | 5 +++- pipeline/.vscode/launch.json.template | 4 +-- pipeline/pom.xml | 11 +++++--- .../src/main/resources/application-test.yaml | 25 ++++++++----------- pipeline/src/main/resources/application.yaml | 14 ++++------- .../security/SecurityConfigTest.java | 12 +-------- 6 files changed, 31 insertions(+), 40 deletions(-) diff --git a/pipeline/.gitignore b/pipeline/.gitignore index c9771109..451b6983 100644 --- a/pipeline/.gitignore +++ b/pipeline/.gitignore @@ -33,4 +33,7 @@ build/ .vscode/* ## Don't Ignore Templates -!.vscode/*.template \ No newline at end of file +!.vscode/*.template + +### SQLite local dev database ### +*.db \ No newline at end of file diff --git a/pipeline/.vscode/launch.json.template b/pipeline/.vscode/launch.json.template index d0ae26c1..811969ca 100644 --- a/pipeline/.vscode/launch.json.template +++ b/pipeline/.vscode/launch.json.template @@ -9,7 +9,7 @@ "projectName": "pipeline", "console": "internalConsole", "env": { - "SPRING_PROFILES_ACTIVE": "default,h2InMemory" + "SPRING_PROFILES_ACTIVE": "default,sqlite" } }, { @@ -20,7 +20,7 @@ "projectName": "pipeline", "console": "internalConsole", "env": { - "SPRING_PROFILES_ACTIVE": "basicAuth,h2InMemory" + "SPRING_PROFILES_ACTIVE": "basicAuth,sqlite" } } ] diff --git a/pipeline/pom.xml b/pipeline/pom.xml index b6abdaf0..64c606af 100644 --- a/pipeline/pom.xml +++ b/pipeline/pom.xml @@ -50,10 +50,15 @@ - com.h2database - h2 + org.xerial + sqlite-jdbc + 3.47.2.0 runtime + + org.hibernate.orm + hibernate-community-dialects + org.projectlombok lombok @@ -318,7 +323,7 @@ default - h2InMemory + sqlite diff --git a/pipeline/src/main/resources/application-test.yaml b/pipeline/src/main/resources/application-test.yaml index 89a9863a..b0d26a6e 100644 --- a/pipeline/src/main/resources/application-test.yaml +++ b/pipeline/src/main/resources/application-test.yaml @@ -2,26 +2,23 @@ spring: datasource: - url: jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE - driverClassName: org.h2.Driver - username: sa + url: jdbc:sqlite:file::memory:?cache=shared + driver-class-name: org.sqlite.JDBC + username: password: - + jpa: hibernate: ddl-auto: create-drop show-sql: false - database-platform: org.hibernate.dialect.H2Dialect - - h2: - console: - enabled: true - path: /h2-console + database-platform: org.hibernate.community.dialect.SQLiteDialect - autoconfigure: - exclude: - - org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration - - org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration + security: + oauth2: + resourceserver: + jwt: + issuer-uri: https://mock-issuer.test + jwk-set-uri: https://mock-jwk-set-uri.test feature-flags: provider: diff --git a/pipeline/src/main/resources/application.yaml b/pipeline/src/main/resources/application.yaml index fee52c16..1a135b87 100644 --- a/pipeline/src/main/resources/application.yaml +++ b/pipeline/src/main/resources/application.yaml @@ -23,20 +23,16 @@ spring: spring: config: activate: - on-profile: h2InMemory + on-profile: sqlite datasource: - url: jdbc:h2:mem:mydb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE - driverClassName: org.h2.Driver - username: sa + url: jdbc:sqlite:./pipeline.db + driver-class-name: org.sqlite.JDBC + username: password: jpa: hibernate: ddl-auto: update show-sql: false - database-platform: org.hibernate.dialect.H2Dialect - h2: - console: - enabled: true - path: /h2-console + database-platform: org.hibernate.community.dialect.SQLiteDialect diff --git a/pipeline/src/test/java/com/autobuild/pipeline/integrationtest/security/SecurityConfigTest.java b/pipeline/src/test/java/com/autobuild/pipeline/integrationtest/security/SecurityConfigTest.java index 011d3aa3..ab60fa52 100644 --- a/pipeline/src/test/java/com/autobuild/pipeline/integrationtest/security/SecurityConfigTest.java +++ b/pipeline/src/test/java/com/autobuild/pipeline/integrationtest/security/SecurityConfigTest.java @@ -9,7 +9,6 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.test.web.servlet.MockMvc; @@ -29,16 +28,7 @@ */ @SpringBootTest @AutoConfigureMockMvc -@ActiveProfiles("demo") -@TestPropertySource(properties = { - "spring.security.oauth2.resourceserver.jwt.issuer-uri=https://mock-issuer.test", - "spring.security.oauth2.resourceserver.jwt.jwk-set-uri=https://mock-jwk-set-uri.test", - "spring.datasource.url=jdbc:h2:mem:testdb", - "spring.datasource.driverClassName=org.h2.Driver", - "spring.datasource.username=sa", - "spring.datasource.password=", - "spring.jpa.hibernate.ddl-auto=create-drop" -}) +@ActiveProfiles("test") class SecurityConfigTest { @Autowired From c77888ed9644096d356002e41ef012695c9f67da Mon Sep 17 00:00:00 2001 From: Baibhab23 Date: Thu, 19 Nov 2026 13:07:50 +0530 Subject: [PATCH 3/3] Refactored Docker setup for development and monitoring stages --- docker-compose.yml | 1 + .../docker-compose-monitoring-integration.yml | 3 +- pipeline/Dockerfile | 42 +++++++++++-------- pipeline/entrypoint.sh | 6 --- 4 files changed, 27 insertions(+), 25 deletions(-) delete mode 100644 pipeline/entrypoint.sh diff --git a/docker-compose.yml b/docker-compose.yml index 88c44c10..7b00e52d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -77,6 +77,7 @@ services: build: context: . dockerfile: pipeline/Dockerfile + target: dev image: pipeline-app container_name: pipeline-app environment: diff --git a/monitoring/docker-compose-monitoring-integration.yml b/monitoring/docker-compose-monitoring-integration.yml index 335b7cb3..6b56289d 100644 --- a/monitoring/docker-compose-monitoring-integration.yml +++ b/monitoring/docker-compose-monitoring-integration.yml @@ -18,8 +18,7 @@ services: build: context: . dockerfile: pipeline/Dockerfile - args: - ENABLE_OTEL: "true" + target: monitoring environment: OTEL_EXPORTER_OTLP_ENDPOINT: http://alloy:4317 OTEL_EXPORTER_OTLP_PROTOCOL: grpc diff --git a/pipeline/Dockerfile b/pipeline/Dockerfile index dac4337a..980840f2 100644 --- a/pipeline/Dockerfile +++ b/pipeline/Dockerfile @@ -1,30 +1,38 @@ # -# Build stage +# Dev build stage # FROM maven:3.9.6-eclipse-temurin-17 AS build -ARG ENABLE_OTEL=false WORKDIR /home/app COPY pipeline/pom.xml . COPY pipeline/src ./src COPY apis/protobuf /home/apis/protobuf -RUN if [ "$ENABLE_OTEL" = "true" ]; then \ - mvn clean package -DskipTests -Pmonitoring; \ - else \ - mvn clean package -DskipTests; \ - fi +RUN mvn clean package -DskipTests # -# Runtime stage +# Monitoring build stage # -FROM eclipse-temurin:17-jdk-jammy -ARG ENABLE_OTEL=false +FROM maven:3.9.6-eclipse-temurin-17 AS build-monitoring +WORKDIR /home/app +COPY pipeline/pom.xml . +COPY pipeline/src ./src +COPY apis/protobuf /home/apis/protobuf +RUN mvn clean package -DskipTests -Pmonitoring + +# +# Dev runtime target +# +FROM eclipse-temurin:17-jdk-jammy AS dev WORKDIR /app COPY --from=build /home/app/target/pipeline*.jar app.jar -RUN --mount=type=bind,from=build,source=/home/app/target,target=/build-output \ - if [ "$ENABLE_OTEL" = "true" ] && [ -f /build-output/agents/opentelemetry-javaagent.jar ]; then \ - cp /build-output/agents/opentelemetry-javaagent.jar /app/otel-agent.jar; \ - fi -COPY pipeline/entrypoint.sh /app/entrypoint.sh -RUN chmod +x /app/entrypoint.sh EXPOSE 8080 -ENTRYPOINT ["/app/entrypoint.sh"] +ENTRYPOINT ["java", "-jar", "app.jar"] + +# +# Monitoring runtime target +# +FROM eclipse-temurin:17-jdk-jammy AS monitoring +WORKDIR /app +COPY --from=build-monitoring /home/app/target/pipeline*.jar app.jar +COPY --from=build-monitoring /home/app/target/agents/opentelemetry-javaagent.jar otel-agent.jar +EXPOSE 8080 +ENTRYPOINT ["java", "-javaagent:otel-agent.jar", "-jar", "app.jar"] diff --git a/pipeline/entrypoint.sh b/pipeline/entrypoint.sh deleted file mode 100644 index 0bbd51f6..00000000 --- a/pipeline/entrypoint.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -if [ -f /app/otel-agent.jar ]; then - exec java -javaagent:/app/otel-agent.jar -jar /app/app.jar "$@" -else - exec java -jar /app/app.jar "$@" -fi