functions.sh : improve oci_push_to_registry (3)

This commit is contained in:
Gitouche 2022-08-13 22:42:36 +02:00
parent caba0e6b1c
commit fc734a7f95
1 changed files with 2 additions and 8 deletions

View File

@ -311,13 +311,7 @@ oci_push_to_registry () {
podman login --username ${CONTAINER_REPO_USER} --password ${CONTAINER_REPO_PASSWORD} ${1%%/*} &&
# Try x times because of unexplained error 500
for i in $(seq 1 3); do podman push ${1} && s=0 && break || s=$? && sleep 1; done; (exit $s) &&
local_digest=$(podman image inspect --format "{{.Digest}}" ${1}) &&
remote_digest=$(skopeo inspect --format "{{.Digest}}" docker://${1}) &&
if [[ ${local_digest} != ${remote_digest} ]]; then
echo 'Digest mismatch between local and remote images'
exit 1
fi
podman image rm ${1}
podman pull ${1}
podman image rm ${1} &&
podman pull ${1} &&
fi
}