Skip to content

Commit

Permalink
common: clean up
Browse files Browse the repository at this point in the history
wip

Signed-off-by: Guillaume Abrioux <[email protected]>
  • Loading branch information
guits committed May 30, 2024
1 parent fe3baff commit 88b9324
Showing 1 changed file with 42 additions and 62 deletions.
104 changes: 42 additions & 62 deletions contrib/build-push-ceph-container-imgs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -274,69 +274,46 @@ declare -F push_ceph_imgs_latest ||
function push_ceph_imgs_latest {
local latest_name

if ${CI_CONTAINER} ; then
if [ -z "$CONTAINER_FLAVOR" ]; then
distro=centos
distro_release=$(_centos_release "${BRANCH}")
else
IFS="," read -r ceph_branch distro distro_release <<< "${CONTAINER_FLAVOR}"
fi
# local_tag should match with daemon_img defined in maint-lib/makelib.mk
local_tag=${CONTAINER_REPO_ORGANIZATION}/daemon-base:${RELEASE}-${CEPH_VERSION}-${distro}-stream${distro_release}-${HOST_ARCH}
full_repo_tag=${CONTAINER_REPO_HOSTNAME}/${CONTAINER_REPO_ORGANIZATION}/ceph:${RELEASE}-${distro}-stream${distro_release}-${HOST_ARCH}-devel
branch_repo_tag=${CONTAINER_REPO_HOSTNAME}/${CONTAINER_REPO_ORGANIZATION}/ceph:${BRANCH}
sha1_repo_tag=${CONTAINER_REPO_HOSTNAME}/${CONTAINER_REPO_ORGANIZATION}/ceph:${SHA1}
# for centos9, while we're still building centos8, add -centos9 to branch and sha1 tags
# to avoid colliding with the existing distrover-less tags for the c8 containers
if [[ ${distro_release} == "9" ]] ; then
branch_repo_tag=${branch_repo_tag}-centos9
sha1_repo_tag=${sha1_repo_tag}-centos9
fi
# add aarch64 suffix for short tags to allow coexisting arches
if [[ ${HOST_ARCH} == "aarch64" ]] ; then
branch_repo_tag=${branch_repo_tag}-aarch64
sha1_repo_tag=${sha1_repo_tag}-aarch64
fi
if [[ "${OSD_FLAVOR}" == "crimson" ]]; then
if [[ "${HOST_ARCH}" == "x86_64" ]]; then
sha1_flavor_repo_tag=${sha1_repo_tag}-${OSD_FLAVOR}
docker tag "$local_tag" "$sha1_flavor_repo_tag"
docker push "$sha1_flavor_repo_tag"
fi
elif [[ "${distro_release}" == "7" ]]; then
docker tag "$local_tag" "$full_repo_tag"
docker push "$full_repo_tag"
else
docker tag "$local_tag" "$full_repo_tag"
docker push "$full_repo_tag"
docker tag "$local_tag" "$branch_repo_tag"
docker tag "$local_tag" "$sha1_repo_tag"
docker push "$branch_repo_tag"
docker push "$sha1_repo_tag"
fi
return
if [ -z "$CONTAINER_FLAVOR" ]; then
distro=centos
distro_release=$(_centos_release "${BRANCH}")
else
IFS="," read -r ceph_branch distro distro_release <<< "${CONTAINER_FLAVOR}"
fi

for release in "${CEPH_RELEASES[@]}" latest; do
if [[ "$release" == "latest" ]]; then
latest_name="latest"
# Use the last item in the array which corresponds to the latest stable Ceph version
release=${CEPH_RELEASES[-1]}
else
latest_name="latest-$release"
fi
if ${DEVEL}; then
latest_name="${latest_name}-devel"
# local_tag should match with daemon_img defined in maint-lib/makelib.mk
local_tag=${CONTAINER_REPO_ORGANIZATION}/daemon-base:${RELEASE}-${CEPH_VERSION}-${distro}-stream${distro_release}-${HOST_ARCH}
full_repo_tag=${CONTAINER_REPO_HOSTNAME}/${CONTAINER_REPO_ORGANIZATION}/ceph:${RELEASE}-${distro}-stream${distro_release}-${HOST_ARCH}-devel
branch_repo_tag=${CONTAINER_REPO_HOSTNAME}/${CONTAINER_REPO_ORGANIZATION}/ceph:${BRANCH}
sha1_repo_tag=${CONTAINER_REPO_HOSTNAME}/${CONTAINER_REPO_ORGANIZATION}/ceph:${SHA1}
# for centos9, while we're still building centos8, add -centos9 to branch and sha1 tags
# to avoid colliding with the existing distrover-less tags for the c8 containers
if [[ ${distro_release} == "9" ]] ; then
branch_repo_tag=${branch_repo_tag}-centos9
sha1_repo_tag=${sha1_repo_tag}-centos9
fi
# add aarch64 suffix for short tags to allow coexisting arches
if [[ ${HOST_ARCH} == "aarch64" ]] ; then
branch_repo_tag=${branch_repo_tag}-aarch64
sha1_repo_tag=${sha1_repo_tag}-aarch64
fi
if [[ "${OSD_FLAVOR}" == "crimson" ]]; then
if [[ "${HOST_ARCH}" == "x86_64" ]]; then
sha1_flavor_repo_tag=${sha1_repo_tag}-${OSD_FLAVOR}
docker tag "$local_tag" "$sha1_flavor_repo_tag"
docker push "$sha1_flavor_repo_tag"
fi
for i in daemon-base daemon demo; do
tag=${CONTAINER_REPO_ORGANIZATION}/$i:${CONTAINER_BRANCH}-${CONTAINER_SHA}-$release-centos-stream$(_centos_release "${release}")-${HOST_ARCH}
# tag image
docker tag "$tag" "${CONTAINER_REPO_ORGANIZATION}"/$i:"$latest_name"

# push image to the registry
docker push "${CONTAINER_REPO_ORGANIZATION}"/$i:"$latest_name"
done
done
elif [[ "${distro_release}" == "7" ]]; then
docker tag "$local_tag" "$full_repo_tag"
docker push "$full_repo_tag"
else
docker tag "$local_tag" "$full_repo_tag"
docker push "$full_repo_tag"
docker tag "$local_tag" "$branch_repo_tag"
docker tag "$local_tag" "$sha1_repo_tag"
docker push "$branch_repo_tag"
docker push "$sha1_repo_tag"
fi
return
}

declare -F wait_for_arm_images ||
Expand Down Expand Up @@ -417,4 +394,7 @@ if $TAGGED_HEAD; then
echo "Don't push latest as we run on a tagged head"
exit 0
fi
push_ceph_imgs_latest

if ${CI_CONTAINER} ; then
push_ceph_imgs_latest
fi

0 comments on commit 88b9324

Please sign in to comment.