From b5c47dbe8a00a49488f3c9f281e74518cb7cd0ba Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Mon, 11 Jul 2022 16:34:16 +0200 Subject: [PATCH] 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. --- test/cases/diff-manifests.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/cases/diff-manifests.sh b/test/cases/diff-manifests.sh index 697e13e8f..3e9ee8820 100755 --- a/test/cases/diff-manifests.sh +++ b/test/cases/diff-manifests.sh @@ -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"