Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(KFLUXVNGD-183): add retries to tkn bundle push #1901

Merged
merged 1 commit into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion task/tkn-bundle-oci-ta/0.1/tkn-bundle-oci-ta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,25 @@ spec:
exit 1
exec 3>&1

retry() {
local status
local retry=0
local -r interval=${RETRY_INTERVAL:-5}
local -r max_retries=5
while true; do
"$@" && break
status=$?
((retry += 1))
if [ $retry -gt $max_retries ]; then
return $status
fi
echo "info: Waiting for a while, then retry ..." 1>&2
sleep "$interval"
done
}

# shellcheck disable=SC2046
OUT="$(tkn bundle push "$IMAGE" \
OUT="$(retry tkn bundle push "$IMAGE" \
$(printf ' -f %s' "${FILES[@]}") |
tee /proc/self/fd/3)"
echo -n "$IMAGE" >"$(results.IMAGE_URL.path)"
Expand Down
19 changes: 18 additions & 1 deletion task/tkn-bundle/0.1/tkn-bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,25 @@ spec:
&& exit 1
exec 3>&1;

retry() {
local status
local retry=0
local -r interval=${RETRY_INTERVAL:-5}
local -r max_retries=5
while true; do
"$@" && break
status=$?
((retry+=1))
if [ $retry -gt $max_retries ]; then
return $status
fi
echo "info: Waiting for a while, then retry ..." 1>&2
sleep "$interval"
done
}

# shellcheck disable=SC2046
OUT="$(tkn bundle push "$IMAGE" \
OUT="$(retry tkn bundle push "$IMAGE" \
$(printf ' -f %s' "${FILES[@]}") \
|tee /proc/self/fd/3)"
echo -n "$IMAGE" > "$(results.IMAGE_URL.path)"
Expand Down
Loading