functions.sh : improve oci_push_to_registry
This commit is contained in:
parent
293594d7f1
commit
dca376462b
10
functions.sh
10
functions.sh
|
@ -310,6 +310,14 @@ oci_push_to_registry () {
|
||||||
if ! skopeo inspect --format "Image ${1} found on remote container repository." docker://${1}; then
|
if ! skopeo inspect --format "Image ${1} found on remote container repository." docker://${1}; then
|
||||||
podman login --username ${CONTAINER_REPO_USER} --password ${CONTAINER_REPO_PASSWORD} ${1%%/*} &&
|
podman login --username ${CONTAINER_REPO_USER} --password ${CONTAINER_REPO_PASSWORD} ${1%%/*} &&
|
||||||
# Try x times because of unexplained error 500
|
# 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)
|
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}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue