Framadate : store to registry (4)

This commit is contained in:
Gitouche 2022-08-16 21:14:37 +02:00
parent 337280858a
commit aa1fd1df33
2 changed files with 11 additions and 6 deletions

View file

@ -308,10 +308,15 @@ else:
oci_push_to_registry () { oci_push_to_registry () {
if ! skopeo inspect --format "Image ${1} found on remote container registry." docker://${1}; then if ! skopeo inspect --format "Image ${1} found on remote container registry." docker://${1}; then
podman login --username ${CONTAINER_REPO_USER} --password ${CONTAINER_REPO_PASSWORD} ${1%%/*} && if podman image exists ${1}; then
# Try x times because of unexplained error 500 podman login --username ${CONTAINER_REPO_USER} --password ${CONTAINER_REPO_PASSWORD} ${1%%/*} &&
for i in $(seq 1 3); do podman push ${1} && s=0 && break || s=$? && sleep 1; done; (exit $s) && # Try x times because of unexplained error 500
podman image rm ${1} && for i in $(seq 1 3); do podman push ${1} && s=0 && break || s=$? && sleep 1; done; (exit $s) &&
podman pull ${1} podman image rm ${1} &&
podman pull ${1}
then
echo "Error : image ${1} does not exists"
exit 1
fi
fi fi
} }

View file

@ -8,7 +8,7 @@ ensure_pwd_is_scriptdir
ensure_not_root ensure_not_root
if ! podman image exists ${framadate_image}:${framadate_version}; then if ! podman image exists ${framadate_image}:${framadate_version}; then
podman build -t "${framadate_image}":"${framadate_version}" --build-arg=version="${framadate_release}" --file ./docker/Dockerfile podman build -t "${framadate_image}":"${framadate_version}" --build-arg=version="${framadate_release}" --file docker/Dockerfile
else else
echo "Image ${framadate_image}:${framadate_version} already built" echo "Image ${framadate_image}:${framadate_version} already built"
fi fi