diff --git a/functions.sh b/functions.sh index 6e87e8e..406f209 100644 --- a/functions.sh +++ b/functions.sh @@ -305,3 +305,11 @@ else: sys.stderr.write('Invalid hash\n') sys.exit(-1)" | elfexec "${@}" } + +oci_push_to_registry () { + if ! skopeo inspect --format "Image ${upstream_images}:${version} found on remote container repository." docker://${upstream_images}:${version}; then + podman login --username ${CONTAINER_REPO_USER} --password ${CONTAINER_REPO_PASSWORD} ${upstream_images%%/*} && + # Try x times because of unexplained error 500 + for i in $(seq 1 3); do podman push ${upstream_images}:${version} && s=0 && break || s=$? && sleep 1; done; (exit $s) + fi +} diff --git a/podman-peerjs/ci_build-images.sh b/podman-peerjs/ci_build-images.sh index 3e96d07..52039a3 100755 --- a/podman-peerjs/ci_build-images.sh +++ b/podman-peerjs/ci_build-images.sh @@ -20,7 +20,4 @@ else echo "Image ${upstream_images}:${version} already built" fi && -if ! skopeo inspect --format "Image ${upstream_images}:${version} found on remote container repository." docker://${upstream_images}:${version}; then - podman login --username ${CONTAINER_REPO_USER} --password ${CONTAINER_REPO_PASSWORD} ${upstream_images%%/*} && - for i in $(seq 1 3); do podman push ${upstream_images}:${version} && s=0 && break || s=$? && sleep 1; done; (exit $s) -fi +oci_push_to_registry ${upstream_images}:${version}