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:
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
# Look inside the CycloneDX SBOM the build produced, and show the one-line mistake that drops it from the jar.
|
||||
source "$(dirname "$0")/lib.sh"
|
||||
SBOM=target/classes/META-INF/sbom/application.cdx.json
|
||||
JAR=target/gitea-actions-demo-1.0.0.jar
|
||||
{
|
||||
banner "mvn -DskipTests package (default: Spring Boot parent wiring)"
|
||||
"${MVN[@]}" -DskipTests clean package 2>&1 | clean | grep -E '^\[INFO\] --- (spring-boot|cyclonedx|jar)|CycloneDX: (Creating|Writing)' | sed -E 's/ @ gitea-actions-demo//; s#/.*/target#target#'
|
||||
echo "jar contains: $(unzip -l $JAR | awk '/sbom\/application/ {print $4}')"
|
||||
banner "Inside $SBOM"
|
||||
python3 - <<'PY'
|
||||
import json, collections
|
||||
b = json.load(open("target/classes/META-INF/sbom/application.cdx.json"))
|
||||
print("bomFormat :", b["bomFormat"])
|
||||
print("specVersion :", b["specVersion"])
|
||||
m = b["metadata"]["component"]
|
||||
print("subject :", m["group"] + ":" + m["name"] + ":" + m["version"], "(" + m["type"] + ")")
|
||||
c = b["components"]
|
||||
print("components :", len(c))
|
||||
print("by scope :", dict(collections.Counter(x.get("scope", "-") for x in c)))
|
||||
print("all have purl :", all("purl" in x for x in c))
|
||||
print("all have hash :", all(x.get("hashes") for x in c))
|
||||
for want in ("spring-boot", "postgresql", "tomcat-embed-core", "jackson-databind", "testcontainers"):
|
||||
hit = [x for x in c if x["name"] == want]
|
||||
print(f"{want:18s}:", hit[0]["purl"] if hit else "(not in SBOM)")
|
||||
print("dependency edges:", len(b.get("dependencies", [])))
|
||||
PY
|
||||
banner "The mistake: -Plate-sbom (re-declares the execution with phase=package)"
|
||||
"${MVN[@]}" -DskipTests -Plate-sbom clean package 2>&1 | clean | grep -E '^\[INFO\] --- (spring-boot|cyclonedx|jar)' | sed -E 's/ @ gitea-actions-demo//'
|
||||
echo "jar contains: $(unzip -l $JAR | awk '/sbom\/application/ {print $4}' | head -1)"
|
||||
echo "(empty above = the SBOM is not in the jar)"
|
||||
"${MVN[@]}" -q -DskipTests clean package >/dev/null 2>&1
|
||||
} 2>&1 | tee "$OUT/04-sbom.txt"
|
||||
Reference in New Issue
Block a user