test/diff-manifests: fail test if manifest generation fails on PR

Fail the test if manifest generation fails on the PR HEAD, but don't
fail if the generation on main fails.
This can happen if something breaks in main (the generator, a
repository, an image definition, etc) and the PR is meant to fix it.
This commit is contained in:
Achilleas Koutsou 2022-07-08 21:12:41 +02:00 committed by Christian Kellner
parent 7f563a6db1
commit 4c7fc8fd4d

View file

@ -57,11 +57,19 @@ manifestdir=$(mktemp -d)
greenprint "Generating all manifests for HEAD (PR #${prnum})"
go run ./cmd/gen-manifests --output "${manifestdir}/PR" --workers 50
err=$?
if (( err != 0 )); then
greenprint "Manifest generation on PR HEAD failed"
exit 1
fi
greenprint "Checking out merge-base ${mergebase}"
git checkout "${mergebase}"
greenprint "Generating all manifests for merge-base (${mergebase})"
# NOTE: it's not an error if this task fails; manifest generation on main can
# be broken in a PR that fixes it.
# As long as the generation on the PR HEAD succeeds, the job should succeed.
go run ./cmd/gen-manifests --output "${manifestdir}/${mergebase}" --workers 50
greenprint "Diff: ${manifestdir}/${mergebase} ${manifestdir}/PR"