diff --git a/.github/workflows/container_integration_tests.yml b/.github/workflows/container_integration_tests.yml index 8396c714135..41c9b912723 100644 --- a/.github/workflows/container_integration_tests.yml +++ b/.github/workflows/container_integration_tests.yml @@ -69,7 +69,26 @@ jobs: run: | set -euo pipefail mvn -version + + # --------------------------- + # FETCH OR BUILD BASE IMAGE + # --------------------------- + - name: Fetch or Build local base image + run: | + set -euo pipefail + # 1. Ask Maven for the expected tag + BASE_IMAGE=$(cd modules/container-base && mvn build-helper:parse-version help:evaluate -Dexpression=base.image -q -DforceStdout -Pct) + echo "Target base image: $BASE_IMAGE" + + # 2. Try to pull it. If that fails, build it. + if docker pull "$BASE_IMAGE"; then + echo "✅ Image found and pulled successfully! Skipping local build." + else + echo "⚠️ Pull failed (image likely doesn't exist yet). Building locally..." + mvn -Pct clean package -f modules/container-base/pom.xml + fi + # --------------------------- # BUILD IMAGES (Dataverse-native) # --------------------------- @@ -282,4 +301,4 @@ jobs: with: name: docker-logs path: docker-logs/ - retention-days: 14 \ No newline at end of file + retention-days: 14 diff --git a/.github/workflows/dataverse_jsf_tests.yml b/.github/workflows/dataverse_jsf_tests.yml index da4b32bf4d2..6d4f348d4f9 100644 --- a/.github/workflows/dataverse_jsf_tests.yml +++ b/.github/workflows/dataverse_jsf_tests.yml @@ -67,6 +67,25 @@ jobs: set -euo pipefail mvn -version + # --------------------------- + # FETCH OR BUILD BASE IMAGE + # --------------------------- + - name: Fetch or Build local base image + run: | + set -euo pipefail + + # 1. Ask Maven for the expected tag + BASE_IMAGE=$(cd modules/container-base && mvn build-helper:parse-version help:evaluate -Dexpression=base.image -q -DforceStdout -Pct) + echo "Target base image: $BASE_IMAGE" + + # 2. Try to pull it. If that fails, build it. + if docker pull "$BASE_IMAGE"; then + echo "✅ Image found and pulled successfully! Skipping local build." + else + echo "⚠️ Pull failed (image likely doesn't exist yet). Building locally..." + mvn -Pct clean package -f modules/container-base/pom.xml + fi + # --------------------------- # BUILD IMAGES (Dataverse-native) # ---------------------------