Skip to content

Commit 3cda61b

Browse files
authored
Merge pull request #21883 from medyagh/kicbuildlogs
fix kicbase build not commenting on faillure
2 parents fb3608c + 72b3986 commit 3cda61b

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

hack/jenkins/kicbase_auto_build.sh

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,21 @@ GCR_IMG=${GCR_REPO}:${KIC_VERSION}
7878
DH_IMG=${DH_REPO}:${KIC_VERSION}
7979
export KICBASE_IMAGE_REGISTRIES="${GCR_IMG} ${DH_IMG}"
8080

81-
# Build a new kicbase image
82-
CIBUILD=yes make push-kic-base-image | tee kic-logs.txt
83-
84-
# Abort with error message if above command failed
85-
ec=$?
86-
if [ $ec -gt 0 ]; then
87-
if [ "$release" = false ]; then
88-
gh pr comment ${ghprbPullId} --body "Hi ${ghprbPullAuthorLoginMention}, building a new kicbase image failed.
81+
82+
if ! CIBUILD=yes make push-kic-base-image | tee kic-logs.txt; then
83+
# Exit of `make` (PIPESTATUS[0]); fallback to 1 if unavailable
84+
ec=${PIPESTATUS[0]:-1}
85+
86+
# Only comment on non-release; default release=false if unset
87+
if [[ ${release:-false} != "true" ]]; then
88+
body=$(cat << EOF
89+
Hi ${ghprbPullAuthorLoginMention}, building a new kicbase image failed.
8990
See the logs at: https://storage.cloud.google.com/minikube-builds/logs/${ghprbPullId}/${ghprbActualCommit::7}/kic_image_build.txt
90-
"
91-
fi
92-
exit $ec
91+
EOF
92+
)
93+
gh pr comment "${ghprbPullId}" --body "$body"
94+
fi
95+
exit "$ec"
9396
fi
9497

9598
# Retrieve the sha from the new image

0 commit comments

Comments
 (0)