Skip to content

Remove digest for pushing to local registry but keep it when pulling #1746

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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: 8 additions & 0 deletions utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,17 @@ function create_cluster() {
cp $ASSET $ASSET_NEW
for IMAGE in $(yq '.. | objects | select(has("containers")) | .containers[].image' $ASSET -r | sort | uniq) ; do
IMAGE_SHORT=${IMAGE##*/}
[[ $IMAGE_SHORT =~ "@" ]] && DIGEST=${IMAGE_SHORT##*@}
# Remove digest from the short name for podman push
IMAGE_SHORT=${IMAGE_SHORT%@*}
IMAGE_MIRRORED=${LOCAL_REGISTRY_DNS_NAME}:${LOCAL_REGISTRY_PORT}/localimages/assets/${IMAGE_SHORT}
sudo -E podman pull --authfile $PULL_SECRET_FILE $IMAGE
sudo podman push --tls-verify=false --remove-signatures --authfile $PULL_SECRET_FILE $IMAGE $IMAGE_MIRRORED
if [[ -n ${DIGEST:-} ]]; then
# Get digest of the pushed image
DIGEST=$(podman inspect --format "{{.Digest}}" $IMAGE_MIRRORED)
IMAGE_MIRRORED="${IMAGE_MIRRORED}@${DIGEST}"
fi
sed -i -e "s%${IMAGE}%${IMAGE_MIRRORED}%g" $ASSET_NEW
done
done
Expand Down