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 be25dd17..6b56289d 100644
--- a/monitoring/docker-compose-monitoring-integration.yml
+++ b/monitoring/docker-compose-monitoring-integration.yml
@@ -15,6 +15,10 @@ services:
condition: service_started
pipeline-app:
+ build:
+ context: .
+ dockerfile: pipeline/Dockerfile
+ target: monitoring
environment:
OTEL_EXPORTER_OTLP_ENDPOINT: http://alloy:4317
OTEL_EXPORTER_OTLP_PROTOCOL: grpc
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/Dockerfile b/pipeline/Dockerfile
index d53c01f7..980840f2 100644
--- a/pipeline/Dockerfile
+++ b/pipeline/Dockerfile
@@ -1,19 +1,38 @@
#
-# Build stage
+# Dev build stage
#
FROM maven:3.9.6-eclipse-temurin-17 AS build
WORKDIR /home/app
COPY pipeline/pom.xml .
COPY pipeline/src ./src
COPY apis/protobuf /home/apis/protobuf
+RUN mvn clean package -DskipTests
+
+#
+# Monitoring build stage
+#
+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
#
-# Runtime stage
+# Dev runtime target
#
-FROM eclipse-temurin:17-jdk-jammy
+FROM eclipse-temurin:17-jdk-jammy AS dev
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
+EXPOSE 8080
+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/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