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

ci: fix container images in quay #775

Merged
merged 1 commit into from
Jul 24, 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
20 changes: 15 additions & 5 deletions ci/container_sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,22 @@ for image in "${container_images[@]}"; do
container=${strarr[1]}
tag=${strarr[2]}
exists=$(curl -H "Authorization: Bearer XYZ" -X GET "https://quay.io/api/v1/repository/kubeinit/$container/tag/" | jq .tags[].name | grep \"$tag\" | uniq)
if [ -z "$exists" ] || [ "$exists" == "\"latest\"" ]; then
echo "The tag $tag in kubeinit/$container is not found or is latest, lets copy the container image."
copy="skopeo copy docker://docker.io/$namespace/$container:$tag docker://quay.io/kubeinit/$container:$tag"
retry 5 $copy

if [ -n "$exists" ]; then
quay_hash=$(skopeo inspect --raw docker://quay.io/kubeinit/$container:$tag | jq -r '.digest')
docker_hash=$(skopeo inspect --raw docker://docker.io/$namespace/$container:$tag | jq -r '.digest')

if [ "$quay_hash" == "$docker_hash" ]; then
echo "The image hashes for tag $tag in kubeinit/$container and docker.io/$namespace/$container match. No update needed."
continue
else
echo "The image hashes for tag $tag in kubeinit/$container and docker.io/$namespace/$container do not match. Updating the image."
fi
else
echo "The tag $tag in kubeinit/$container is found and is not latest, no need to copy anything."
echo "The tag $tag in kubeinit/$container is not found. Copying the container image."
fi

copy="skopeo copy docker://docker.io/$namespace/$container:$tag docker://quay.io/kubeinit/$container:$tag"
retry 5 $copy

done
Loading