fix: ensure java image build failures stop the build (#4531)

---------
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
Alex Goodman 2026-01-06 11:43:51 -05:00 committed by GitHub
parent 3ea6a03cd0
commit ed339e4fed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 15 additions and 19 deletions

View File

@ -13,12 +13,11 @@ jobs:
Publish: Publish:
name: "Publish test fixture image cache" name: "Publish test fixture image cache"
# runs-on.com: memory-optimized instances for building test fixture cache # runs-on.com: general purpose instances for building test fixture cache
# spot disabled: can run up to an hour, avoid interruptions # spot disabled: can run up to an hour, avoid interruptions
# disk=large: need more storage for docker images and fixture cache
# s3-cache: faster actions cache # s3-cache: faster actions cache
# tmpfs: faster io-intensive workflows # family: note that m*d instances have local nvme storage which is beneficial for building large test fixture images
runs-on: runs-on=${{ github.run_id }}/cpu=4+8/ram=64+128/family=r5+r6+r7+r8/spot=false/extras=s3-cache+tmpfs runs-on: "runs-on=${{ github.run_id }}/cpu=8+16/ram=32+64/family=m5d+m5ad+m5dn+m6gd+m6id+m6idn+m7gd+m8gd/spot=false/extras=s3-cache"
if: github.repository == 'anchore/syft' # only run for main repo if: github.repository == 'anchore/syft' # only run for main repo
permissions: permissions:
packages: write packages: write

View File

@ -373,6 +373,9 @@ tasks:
# this will look for `test-fixtures/Makefile` and invoke the `fixtures` target to generate any and all test fixtures # this will look for `test-fixtures/Makefile` and invoke the `fixtures` target to generate any and all test fixtures
cmds: cmds:
- | - |
# we want to stop on the first build error
set -e
BOLD='\033[1m' BOLD='\033[1m'
YELLOW='\033[0;33m' YELLOW='\033[0;33m'
RESET='\033[0m' RESET='\033[0m'
@ -381,7 +384,7 @@ tasks:
for dir in $(find . -type d -name 'test-fixtures'); do for dir in $(find . -type d -name 'test-fixtures'); do
if [ -f "$dir/Makefile" ]; then if [ -f "$dir/Makefile" ]; then
echo -e "${YELLOW}${BOLD}generating fixtures in $dir${RESET}" echo -e "${YELLOW}${BOLD}generating fixtures in $dir${RESET}"
(make -C "$dir" fixtures) make -C "$dir" fixtures
fi fi
done done
echo -e "${BOLD}generated all fixtures${RESET}" echo -e "${BOLD}generated all fixtures${RESET}"

View File

@ -3,13 +3,13 @@
default: default:
@for dir in $(shell find . -mindepth 1 -maxdepth 1 -type d); do \ @for dir in $(shell find . -mindepth 1 -maxdepth 1 -type d); do \
if [ -f "$$dir/Makefile" ]; then \ if [ -f "$$dir/Makefile" ]; then \
$(MAKE) -C $$dir; \ $(MAKE) -C $$dir || exit 1; \
fi; \ fi; \
done done
%: %:
@for dir in $(shell find . -mindepth 1 -maxdepth 1 -type d); do \ @for dir in $(shell find . -mindepth 1 -maxdepth 1 -type d); do \
if [ -f "$$dir/Makefile" ]; then \ if [ -f "$$dir/Makefile" ]; then \
$(MAKE) -C $$dir $@; \ $(MAKE) -C $$dir $@ || exit 1; \
fi; \ fi; \
done done

View File

@ -3,13 +3,13 @@
default: default:
@for dir in $(shell find . -mindepth 1 -maxdepth 1 -type d); do \ @for dir in $(shell find . -mindepth 1 -maxdepth 1 -type d); do \
if [ -f "$$dir/Makefile" ]; then \ if [ -f "$$dir/Makefile" ]; then \
$(MAKE) -C $$dir; \ $(MAKE) -C $$dir || exit 1; \
fi; \ fi; \
done done
%: %:
@for dir in $(shell find . -mindepth 1 -maxdepth 1 -type d); do \ @for dir in $(shell find . -mindepth 1 -maxdepth 1 -type d); do \
if [ -f "$$dir/Makefile" ]; then \ if [ -f "$$dir/Makefile" ]; then \
$(MAKE) -C $$dir $@; \ $(MAKE) -C $$dir $@ || exit 1; \
fi; \ fi; \
done done

View File

@ -3,13 +3,13 @@
default: default:
@for dir in $(shell find . -mindepth 1 -maxdepth 1 -type d); do \ @for dir in $(shell find . -mindepth 1 -maxdepth 1 -type d); do \
if [ -f "$$dir/Makefile" ]; then \ if [ -f "$$dir/Makefile" ]; then \
$(MAKE) -C $$dir; \ $(MAKE) -C $$dir || exit 1; \
fi; \ fi; \
done done
%: %:
@for dir in $(shell find . -mindepth 1 -maxdepth 1 -type d); do \ @for dir in $(shell find . -mindepth 1 -maxdepth 1 -type d); do \
if [ -f "$$dir/Makefile" ]; then \ if [ -f "$$dir/Makefile" ]; then \
$(MAKE) -C $$dir $@; \ $(MAKE) -C $$dir $@ || exit 1; \
fi; \ fi; \
done done

View File

@ -11,7 +11,6 @@ function cleanup() {
} }
trap cleanup EXIT trap cleanup EXIT
set +e
docker cp "$(pwd)/example-java-app" "${CTRID}:/" docker cp "$(pwd)/example-java-app" "${CTRID}:/"
docker start -a "${CTRID}" docker start -a "${CTRID}"

View File

@ -11,7 +11,6 @@ function cleanup() {
} }
trap cleanup EXIT trap cleanup EXIT
set +e
docker cp "$(pwd)/example-java-app" "${CTRID}:/" docker cp "$(pwd)/example-java-app" "${CTRID}:/"
docker start -a "${CTRID}" docker start -a "${CTRID}"

View File

@ -3,16 +3,14 @@ set -uxe
PKGSDIR=$1 PKGSDIR=$1
CTRID=$(docker create -v /example-java-app ghcr.io/graalvm/native-image:22.2.0 -cp /example-java-app/example-java-app-maven-0.1.0.jar -XX:-UseContainerSupport --no-fallback -H:Class=hello.HelloWorld -H:Name=example-java-app) CTRID=$(docker create -v /example-java-app ghcr.io/graalvm/native-image:22.2.0 -J-XX:-UseContainerSupport -cp /example-java-app/example-java-app-maven-0.1.0.jar --no-fallback -H:Class=hello.HelloWorld -H:Name=example-java-app)
function cleanup() { function cleanup() {
docker rm "${CTRID}" docker rm "${CTRID}"
} }
trap cleanup EXIT trap cleanup EXIT
set +e
docker cp "${PKGSDIR}/example-java-app-maven-0.1.0.jar" "${CTRID}:/example-java-app/" docker cp "${PKGSDIR}/example-java-app-maven-0.1.0.jar" "${CTRID}:/example-java-app/"
docker start -a "${CTRID}" docker start -a "${CTRID}"
docker cp "${CTRID}:/app/example-java-app" $PKGSDIR docker cp "${CTRID}:/app/example-java-app" "$PKGSDIR"

View File

@ -11,7 +11,6 @@ function cleanup() {
} }
trap cleanup EXIT trap cleanup EXIT
set +e
docker cp "$(pwd)/example-jenkins-plugin" "${CTRID}:/" docker cp "$(pwd)/example-jenkins-plugin" "${CTRID}:/"
docker start -a "${CTRID}" docker start -a "${CTRID}"

View File

@ -11,7 +11,6 @@ function cleanup() {
} }
trap cleanup EXIT trap cleanup EXIT
set +e
docker cp "$(pwd)/example-sb-app" "${CTRID}:/" docker cp "$(pwd)/example-sb-app" "${CTRID}:/"
docker start -a "${CTRID}" docker start -a "${CTRID}"