functions.sh:oci_push_to_registry simplification push vers registry

This commit is contained in:
Gitouche 2023-02-25 18:06:30 +01:00
parent e810a20ce7
commit 5d7ddb2bd9

View file

@ -311,10 +311,7 @@ oci_push_to_registry () {
if ! skopeo inspect --format "Image ${1} found on remote container registry." docker://${1}; then
if podman image exists ${1}; then
ensure_variables_are_defined "CONTAINER_REPO_USER CONTAINER_REPO_PASSWORD"
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) &&
podman logout ${1%%/*} &&
podman push --creds=${CONTAINER_REPO_USER}:${CONTAINER_REPO_PASSWORD} ${1} &&
podman image rm ${1} &&
podman pull ${1}
else