Add gitea-actions: Spring Boot 4.2.0 CI with surefire/failsafe, Testcontainers, CycloneDX SBOM and Jib
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b69H5rTewUKPyhGS8r
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
|
||||
=== Toolchain ===
|
||||
openjdk version "25.0.5.1" 2026-11-17 LTS
|
||||
OpenJDK Runtime Environment Temurin-25.0.5.1+2 (build 25.0.5.1+2-LTS)
|
||||
OpenJDK 64-Bit Server VM Temurin-25.0.5.1+2 (build 25.0.5.1+2-LTS, mixed mode, sharing)
|
||||
Apache Maven 3.9.11 (3e54c93a704957b63ee3494413a2b544fd3d825b)
|
||||
Java version: 25.0.5.1, vendor: Eclipse Adoptium, runtime: /tmp/tools/jdk-25.0.5.1+2
|
||||
Docker engine 29.9.3
|
||||
|
||||
=== Versions pinned by the module ===
|
||||
<version>4.2.0</version>
|
||||
<java.version>25</java.version>
|
||||
<jib.version>3.5.2</jib.version>
|
||||
|
||||
=== Images used ===
|
||||
postgres:17-alpine
|
||||
eclipse-temurin:25-jre
|
||||
|
||||
=== Gitea server this was checked against ===
|
||||
{"version":"1.27.3"}
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
=== mvn verify -DskipITs, local repository = /tmp/m2-cold-demo ===
|
||||
cold (empty local repository) downloads: 599 seconds: 44
|
||||
warm (repository restored) downloads: 0 seconds: 11
|
||||
local repository size after the run: 110M
|
||||
(seconds depend on the network; the download counts are the point)
|
||||
@@ -0,0 +1,33 @@
|
||||
|
||||
=== mvn -B -ntp verify (key lines) ===
|
||||
[INFO] --- clean:3.5.0:clean (default-clean) ---
|
||||
[INFO] --- cyclonedx:2.9.3:makeAggregateBom (default) ---
|
||||
[INFO] --- resources:3.5.0:resources (default-resources) ---
|
||||
[INFO] --- compiler:3.16.0:compile (default-compile) ---
|
||||
[INFO] --- resources:3.5.0:testResources (default-testResources) ---
|
||||
[INFO] --- compiler:3.16.0:testCompile (default-testCompile) ---
|
||||
[INFO] --- surefire:3.6.1:test (default-test) ---
|
||||
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0 -- in <class>
|
||||
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
|
||||
[INFO] --- jar:3.5.1:jar (default-jar) ---
|
||||
[INFO] --- spring-boot:4.2.0:repackage (repackage) ---
|
||||
[INFO] Replacing main artifact /tmp/dd/gitea-actions/target/gitea-actions-demo-1.0.0.jar with repackaged archive, adding nested dependencies in BOOT-INF/.
|
||||
[INFO] --- failsafe:3.6.1:integration-test (default) ---
|
||||
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0 -- in <class>
|
||||
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
|
||||
[INFO] --- failsafe:3.6.1:verify (default) ---
|
||||
[INFO] BUILD SUCCESS
|
||||
|
||||
=== target/ after the build ===
|
||||
gitea-actions-demo-1.0.0.jar
|
||||
gitea-actions-demo-1.0.0.jar.original
|
||||
|
||||
=== Same command where Docker is really unreachable (docker.sock masked in a private mount namespace) ===
|
||||
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0 -- in <class>
|
||||
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
|
||||
23:57:14.999 [main] ERROR org.testcontainers.dockerclient.DockerClientProviderStrategy -- Could not find a valid Docker environment. Please check configuration. Attempted configurations were:
|
||||
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0 <<< FAILURE! -- in <class>
|
||||
java.lang.IllegalStateException: Could not find a valid Docker environment. Please see logs and check configuration
|
||||
[ERROR] TicketApiIT.initializationError ? IllegalState Could not find a valid Docker environment. Please see logs and check configuration
|
||||
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
|
||||
[INFO] BUILD FAILURE
|
||||
@@ -0,0 +1,30 @@
|
||||
|
||||
=== mvn -DskipTests package (default: Spring Boot parent wiring) ===
|
||||
[INFO] --- cyclonedx:2.9.3:makeAggregateBom (default) ---
|
||||
[INFO] CycloneDX: Creating BOM version 1.6 with 59 component(s)
|
||||
[INFO] CycloneDX: Writing and validating BOM (JSON): target/classes/META-INF/sbom/application.cdx.json
|
||||
[INFO] --- jar:3.5.1:jar (default-jar) ---
|
||||
[INFO] --- spring-boot:4.2.0:repackage (repackage) ---
|
||||
jar contains: META-INF/sbom/application.cdx.json
|
||||
|
||||
=== Inside target/classes/META-INF/sbom/application.cdx.json ===
|
||||
bomFormat : CycloneDX
|
||||
specVersion : 1.6
|
||||
subject : com.ankurm.ci:gitea-actions-demo:1.0.0 (application)
|
||||
components : 59
|
||||
by scope : {'required': 59}
|
||||
all have purl : True
|
||||
all have hash : True
|
||||
spring-boot : pkg:maven/org.springframework.boot/[email protected]?type=jar
|
||||
postgresql : pkg:maven/org.postgresql/[email protected]?type=jar
|
||||
tomcat-embed-core : pkg:maven/org.apache.tomcat.embed/[email protected]?type=jar
|
||||
jackson-databind : pkg:maven/tools.jackson.core/[email protected]?type=jar
|
||||
testcontainers : (not in SBOM)
|
||||
dependency edges: 60
|
||||
|
||||
=== The mistake: -Plate-sbom (re-declares the execution with phase=package) ===
|
||||
[INFO] --- jar:3.5.1:jar (default-jar) ---
|
||||
[INFO] --- spring-boot:4.2.0:repackage (repackage) ---
|
||||
[INFO] --- cyclonedx:2.9.3:makeAggregateBom (default) ---
|
||||
jar contains:
|
||||
(empty above = the SBOM is not in the jar)
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
=== 1. mvn -DskipTests jib:build, base image pulled from Docker Hub (non-deterministic: depends on the rate limit) ===
|
||||
[INFO] Built and pushed image as localhost:5000/gitea-actions-demo, localhost:5000/gitea-actions-demo:1.0.0
|
||||
[INFO] BUILD SUCCESS
|
||||
|
||||
=== 2. same, base image read from the runner's local Docker daemon (-Djib.from.image=docker://...) ===
|
||||
[INFO] Container entrypoint set to [java, -cp, @/app/jib-classpath-file, com.ankurm.ci.Application]
|
||||
[INFO] Built and pushed image as localhost:5000/gitea-actions-demo, localhost:5000/gitea-actions-demo:1.0.0
|
||||
[INFO] BUILD SUCCESS
|
||||
|
||||
=== Registry catalog and tags ===
|
||||
{"repositories":["gitea-actions-demo"]}
|
||||
|
||||
{"name":"gitea-actions-demo","tags":["latest","1.0.0"]}
|
||||
|
||||
|
||||
=== Layers in the pushed manifest ===
|
||||
42166579 sha256:517b871c26ea...
|
||||
389 sha256:96aae9022e0e...
|
||||
18461849 sha256:5050cb6f0906...
|
||||
63112449 sha256:dbda3fb9544c...
|
||||
32 sha256:4f4fb700ef54...
|
||||
2464 sha256:fa06fe8ddd50...
|
||||
22267190 sha256:5c4c7fb44e21...
|
||||
33240 sha256:79d4cb011a48...
|
||||
3760 sha256:97981627ec22...
|
||||
824 sha256:11c50fd61d93...
|
||||
layers: 10
|
||||
|
||||
=== Image config (user, ports, entrypoint) ===
|
||||
user=1000 ports=map[8080/tcp:{}] entrypoint=[java -cp @/app/jib-classpath-file com.ankurm.ci.Application]
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
=== 1. Where does the container registry answer? ===
|
||||
https://ankurm.com/v2/ -> HTTP 404
|
||||
https://ankurm.com/git.app/v2/ -> HTTP 200
|
||||
|
||||
=== 2. docker login and docker push the way every tutorial writes it ===
|
||||
$ docker login ankurm.com
|
||||
Error response from daemon: login attempt to https://ankurm.com/v2/ failed with status: 404 Not Found
|
||||
$ docker push ankurm.com/asmhatre/gitea-actions-probe:1
|
||||
unknown: unexpected status from POST request to https://ankurm.com/v2/asmhatre/gitea-actions-probe/blobs/uploads/: 404 Not Found
|
||||
|
||||
=== 3. The generic package registry works under the sub-path: upload the SBOM ===
|
||||
$ curl --upload-file target/classes/META-INF/sbom/application.cdx.json https://ankurm.com/git.app/api/packages/asmhatre/generic/gitea-actions-demo-sbom/1.0.0-demo/application.cdx.json
|
||||
PUT first time -> HTTP 201
|
||||
PUT second time -> HTTP 409 (a file name can be published once per version)
|
||||
downloaded back: CycloneDX 1.6 59 components
|
||||
DELETE version -> HTTP 204
|
||||
|
||||
=== 4. Bad file name ===
|
||||
PUT file with a space in its name -> HTTP 201
|
||||
DELETE version (cleanup) -> HTTP 204
|
||||
packages left named gitea-actions-demo-sbom: 0
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
=== Parse .gitea/workflows/ci.yaml ===
|
||||
name : ci
|
||||
triggers : ['push', 'pull_request']
|
||||
job build : runs-on=ubuntu-latest needs=- steps=4
|
||||
- actions/checkout@v4
|
||||
- actions/setup-java@v4
|
||||
- Build, test, SBOM
|
||||
- Publish SBOM to the generic package registry
|
||||
job image : runs-on=ubuntu-latest needs=build steps=3
|
||||
- actions/checkout@v4
|
||||
- actions/setup-java@v4
|
||||
- Build and push image with Jib
|
||||
|
||||
=== Secrets are only ever referenced through env:, never inside a run: line ===
|
||||
ok: no secret interpolated into a shell command
|
||||
|
||||
=== Secret names obey Gitea's rules (no GITHUB_/GITEA_ prefix) ===
|
||||
secrets.PACKAGES_TOKEN
|
||||
secrets.REGISTRY_PASSWORD
|
||||
secrets.REGISTRY_USER
|
||||
Reference in New Issue
Block a user