Skip to content

Commit dfb4f36

Browse files
authored
Merge pull request #21544 from medyagh/iso_fail_comment_fix
ci: fix failed ISO not commenting on PR
2 parents 71227b2 + 3a8d719 commit dfb4f36

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

hack/jenkins/build_iso.sh

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,23 @@ else
6565
export ISO_BUCKET
6666
fi
6767

68-
make release-iso | tee iso-logs.txt
69-
# Abort with error message if above command failed
70-
ec=$?
71-
if [ $ec -gt 0 ]; then
72-
if [ "$release" = false ]; then
73-
gh pr comment ${ghprbPullId} --body "Hi ${ghprbPullAuthorLoginMention}, building a new ISO failed.
74-
See the logs at: https://storage.cloud.google.com/minikube-builds/logs/${ghprbPullId}/${ghprbActualCommit::7}/iso_build.txt
75-
"
76-
fi
77-
exit $ec
68+
if ! make release-iso 2>&1 | tee iso-logs.txt; then
69+
# Exit of `make` (PIPESTATUS[0]); fallback to 1 if unavailable
70+
ec=${PIPESTATUS[0]:-1}
71+
72+
# Only comment on non-release; default release=false if unset
73+
if [[ ${release:-false} != "true" ]]; then
74+
body="$(cat <<'EOF'
75+
Hi ${ghprbPullAuthorLoginMention}, building a new ISO failed for Commit ${ghprbActualCommit}
76+
See the logs at:
77+
https://storage.cloud.google.com/minikube-builds/logs/${ghprbPullId}/${ghprbActualCommit::7}/iso_build.txt
78+
EOF
79+
"
80+
81+
gh pr comment "${ghprbPullId}" --body "$body"
82+
83+
fi
84+
exit "$ec"
7885
fi
7986
8087
git config user.name "minikube-bot"

0 commit comments

Comments
 (0)