test/diff-manifests: warn if generation fails on merge-base

If the manifest generation fails on the merge-base with main (the target
branch of the PR), add a note to the review comment.
This commit is contained in:
Achilleas Koutsou 2022-07-11 16:34:16 +02:00 committed by Christian Kellner
parent 404d1130bd
commit b5c47dbe8a

View file

@ -71,6 +71,12 @@ greenprint "Generating all manifests for merge-base (${mergebase})"
# 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
err=$?
merge_base_fail=""
if (( err != 0 )); then
greenprint "Manifest generation on merge-base failed"
merge_base_fail="**NOTE:** Manifest generation on merge-base with \`main\` (${mergebase}) failed.\n\n"
fi
greenprint "Diff: ${manifestdir}/${mergebase} ${manifestdir}/PR"
diff=$(diff -Naur "${manifestdir}"/"${mergebase}" "${manifestdir}/PR")
@ -90,7 +96,7 @@ greenprint "Saved diff in job artifacts"
artifacts_url="${CI_JOB_URL}/artifacts/browse/ci-artifacts"
cat > "${review_data_file}" << EOF
{"body":"⚠️ This PR introduces changes in at least one manifest (when comparing PR HEAD ${head} with the main merge-base ${mergebase}). Please review the changes. The changes can be found in the [artifacts of the \`Manifest-diff\` job [0]](${artifacts_url}) as \`manifests.diff\`.\n\n[0] ${artifacts_url}","event":"COMMENT"}
{"body":"⚠️ This PR introduces changes in at least one manifest (when comparing PR HEAD ${head} with the main merge-base ${mergebase}). Please review the changes. The changes can be found in the [artifacts of the \`Manifest-diff\` job [0]](${artifacts_url}) as \`manifests.diff\`.\n\n${merge_base_fail}[0] ${artifacts_url}","event":"COMMENT"}
EOF
greenprint "Posting review comment"