44# repo auth with write perms must be present (this script does not log into
55# repos named by CONTAINER_REPO_*).
66# If NO_PUSH is set, no login is necessary
7+ # If REMOVE_LOCAL_IMAGES is true (the default), local images are removed
8+ # after push. If you want to save local image copies, set this to false.
79
810
911CFILE=${1:- Containerfile}
@@ -25,11 +27,13 @@ CONTAINER_REPO_USERNAME
2527CONTAINER_REPO_PASSWORD
2628PRERELEASE_USERNAME for download.ceph.com:/prerelease/ceph
2729PRERELEASE_PASSWORD
30+ REMOVE_LOCAL_IMAGES set to 'false' if you want to keep local images
2831
2932For a release build: (from ceph.git, built and pushed to download.ceph.com)
3033CI_CONTAINER: must be 'false'
3134and you must also add
3235VERSION (for instance, 19.1.0) for tagging the image
36+ REMOVE_LOCAL_IMAGES set to 'false' if you want to keep local images
3337
3438You can avoid the push step (for testing) by setting NO_PUSH to anything
3539EOF
@@ -48,6 +52,7 @@ REPO_ARCH=amd64
4852if [[ " ${ARCH} " = arm64 ]] ; then
4953 REPO_ARCH=arm64
5054fi
55+ REMOVE_LOCAL_IMAGES=${REMOVE_LOCAL_IMAGES:- true}
5156
5257if [[ ${CI_CONTAINER} == " true" ]] ; then
5358 CONTAINER_REPO_HOSTNAME=${CONTAINER_REPO_HOSTNAME:- quay.ceph.io}
6772: " ${BRANCH:? } "
6873: " ${CEPH_SHA1:? } "
6974: " ${ARCH:? } "
75+ : " ${REMOVE_LOCAL_IMAGES:? } "
7076if [[ ${NO_PUSH} != " true" ]] ; then
7177 : " ${CONTAINER_REPO_HOSTNAME:? } "
7278 : " ${CONTAINER_REPO_ORGANIZATION:? } "
@@ -173,6 +179,9 @@ if [[ ${CI_CONTAINER} == "true" ]] ; then
173179 podman tag ${image_id} ${sha1_flavor_repo_tag}
174180 if [[ -z " ${NO_PUSH} " ]] ; then
175181 podman push ${sha1_flavor_repo_tag}
182+ if [[ ${REMOVE_LOCAL_IMAGES} == " true" ]] ; then
183+ podman rmi -f ${sha1_flavor_repo_tag}
184+ fi
176185 fi
177186 exit
178187 fi
@@ -181,6 +190,9 @@ if [[ ${CI_CONTAINER} == "true" ]] ; then
181190 podman push ${full_repo_tag}
182191 podman push ${branch_repo_tag}
183192 podman push ${sha1_repo_tag}
193+ if [[ ${REMOVE_LOCAL_IMAGES} == " true" ]] ; then
194+ podman rmi -f ${full_repo_tag} ${branch_repo_tag} ${sha1_repo_tag}
195+ fi
184196 fi
185197else
186198 #
192204 podman tag ${image_id} ${version_tag}
193205 if [[ -z " ${NO_PUSH} " ]] ; then
194206 podman push ${version_tag}
207+ if [[ ${REMOVE_LOCAL_IMAGES} == " true" ]] ; then
208+ podman rmi -f ${version_tag}
209+ fi
195210 fi
196211fi
197212
198-
0 commit comments