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

hack/build-and-push.sh: fix digest existence check #904

Merged
merged 2 commits into from
Apr 3, 2024
Merged
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
8 changes: 4 additions & 4 deletions hack/build-and-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,17 @@ do
repository=${TEST_REPO_NAME:-task-${task_name}}
tag=${TEST_REPO_NAME:+${task_name}-}${task_version}
task_bundle=quay.io/$MY_QUAY_USER/${repository}:${tag}
digest=$(curl -s https://quay.io/api/v1/repository/$MY_QUAY_USER/$repository/tag/?specificTag=${tag}-${task_file_sha} | yq '.tags[0].manifest_digest')
if [ "$digest" == "null" ]; then

if digest=$(skopeo inspect --no-tags --format='{{.Digest}}' docker://"${task_bundle}-${task_file_sha}" 2>/dev/null); then
task_bundle_with_digest=${task_bundle}@${digest}
else
output=$(tkn_bundle_push -f "$prepared_task_file" "$task_bundle" | save_ref "$task_bundle" "$OUTPUT_TASK_BUNDLE_LIST")
echo "$output"
task_bundle_with_digest="${output##*$'\n'}"

# copy task to new tag pointing to commit where the file was changed lastly, so that image persists
# even when original tag is updated
skopeo copy "docker://${task_bundle}" "docker://${task_bundle}-${task_file_sha}"
else
task_bundle_with_digest=${task_bundle}@${digest}
fi
# version placeholder is removed naturally by the substitution.
real_task_name=$(yq e '.metadata.name' "$prepared_task_file")
Expand Down