Skip to content

Commit

Permalink
Fix error handling in tkn_bundle_push
Browse files Browse the repository at this point in the history
When `tkn bundle push` exits with code not equal to 0, due to `errexit`
being turned on (`set -e`) the script is terminated immediately without
retrying. This changes the logic so if the `tkn bundle push` succeeds
the retying while loop is stopped, i.e. the `&& break` branch is
executed. In case of errors the `&& break` branch is not executed and
the status of `tkn bundle push` is captured in the `status` variable,
the retrying `while` loop continues until `max_retries` is reached.
  • Loading branch information
zregvart committed May 2, 2024
1 parent fd9c5cb commit 30d60c5
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions hack/build-and-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@ tkn_bundle_push() {
local -r interval=${RETRY_INTERVAL:-5}
local -r max_retries=5
while true; do
tkn bundle push "$@"
tkn bundle push "$@" && break
status=$?
if [ $status == 0 ]; then
break
fi
((retry+=1))
if [ $retry -gt $max_retries ]; then
return $status
Expand Down

0 comments on commit 30d60c5

Please sign in to comment.