Skip to content

Commit 1fb6137

Browse files
committed
container/build.sh: fix up org vs. repo naming
release builds were using the wrong container repo name because of confused variable naming and inadequate separation. Keep the hostname, org name, and repo name in separate variables, and assemble the full path with a version when tagging is done. Signed-off-by: Dan Mick <[email protected]>
1 parent e203f85 commit 1fb6137

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

container/build.sh

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# vim: ts=4 sw=4 expandtab
33

44
# repo auth with write perms must be present (this script does not log into
5-
# CONTAINER_REPO_HOSTNAME and CONTAINER_REPO_ORGANIZATION).
5+
# repos named by CONTAINER_REPO_*).
66
# If NO_PUSH is set, no login is necessary
77

88

@@ -20,6 +20,7 @@ CEPH_SHA1 (of Ceph)
2020
ARCH (of build host, and resulting container)
2121
CONTAINER_REPO_HOSTNAME (quay.ceph.io, for CI, for instance)
2222
CONTAINER_REPO_ORGANIZATION (ceph-ci, for CI, for instance)
23+
CONTAINER_REPO (ceph, for CI, or prerelease-<arch> for release, for instance)
2324
CONTAINER_REPO_USERNAME
2425
CONTAINER_REPO_PASSWORD
2526
PRERELEASE_USERNAME for download.ceph.com:/prerelease/ceph
@@ -50,10 +51,12 @@ fi
5051

5152
if [[ ${CI_CONTAINER} == "true" ]] ; then
5253
CONTAINER_REPO_HOSTNAME=${CONTAINER_REPO_HOSTNAME:-quay.ceph.io}
53-
CONTAINER_REPO_ORGANIZATION=${CONTAINER_REPO_ORGANIZATION:-ceph-ci/ceph}
54+
CONTAINER_REPO_ORGANIZATION=${CONTAINER_REPO_ORGANIZATION:-ceph-ci}
55+
CONTAINER_REPO=${CONTAINER_REPO:-ceph}
5456
else
5557
CONTAINER_REPO_HOSTNAME=${CONTAINER_REPO_HOSTNAME:-quay.ceph.io}
56-
CONTAINER_REPO_ORGANIZATION=${CONTAINER_REPO_ORGANIZATION:-ceph/prerelease-${REPO_ARCH}}
58+
CONTAINER_REPO_ORGANIZATION=${CONTAINER_REPO_ORGANIZATION:-ceph}
59+
CONTAINER_REPO=${CONTAINER_REPO:-prerelease-${REPO_ARCH}}
5760
# default: most-recent annotated tag
5861
VERSION=${VERSION:-$(git describe --abbrev=0)}
5962
fi
@@ -71,13 +74,13 @@ fi
7174
if [[ ${CI_CONTAINER} != "true" ]] ; then : "${VERSION:?}"; fi
7275

7376
# check for valid repo auth (if pushing)
74-
ORGURL=${CONTAINER_REPO_HOSTNAME}/${CONTAINER_REPO_ORGANIZATION}
75-
MINIMAL_IMAGE=${ORGURL}/ceph:minimal-test
77+
repopath=${CONTAINER_REPO_HOSTNAME}/${CONTAINER_REPO_ORGANIZATION}/${CONTAINER_REPO}
78+
MINIMAL_IMAGE=${repopath}:minimal-test
7679
if [[ ${NO_PUSH} != "true" ]] ; then
7780
podman rmi ${MINIMAL_IMAGE} || true
7881
echo "FROM scratch" | podman build -f - -t ${MINIMAL_IMAGE}
7982
if ! podman push ${MINIMAL_IMAGE} ; then
80-
echo "Not authenticated to ${ORGURL}; need docker/podman login?"
83+
echo "Not authenticated to ${repopath}; need docker/podman login?"
8184
exit 1
8285
fi
8386
podman rmi ${MINIMAL_IMAGE} | true
@@ -145,14 +148,14 @@ fromtag=${fromtag/:/-}
145148
builddate=$(date -u +%Y%m%d)
146149
local_tag=${fromtag}-${CEPH_CONTAINER_CEPH_REF}-${CEPH_CONTAINER_ARCH}-${builddate}
147150

148-
repopath=${CONTAINER_REPO_HOSTNAME}/${CONTAINER_REPO_ORGANIZATION}
151+
repopath=${CONTAINER_REPO_HOSTNAME}/${CONTAINER_REPO_ORGANIZATION}/${CONTAINER_REPO}
149152

150153
if [[ ${CI_CONTAINER} == "true" ]] ; then
151154
# ceph-ci conventions for remote tags:
152155
# requires ARCH, BRANCH, CEPH_SHA1, FLAVOR
153-
full_repo_tag=$repopath/ceph:${BRANCH}-${fromtag}-${ARCH}-devel
154-
branch_repo_tag=$repopath/ceph:${BRANCH}
155-
sha1_repo_tag=$repopath/ceph:${CEPH_SHA1}
156+
full_repo_tag=${repopath}:${BRANCH}-${fromtag}-${ARCH}-devel
157+
branch_repo_tag=${repopath}:${BRANCH}
158+
sha1_repo_tag=${repopath}:${CEPH_SHA1}
156159

157160
if [[ "${ARCH}" == "arm64" ]] ; then
158161
branch_repo_tag=${branch_repo_tag}-arm64
@@ -182,7 +185,7 @@ else
182185
# non-CI build. Tags are like v19.1.0-20240701
183186
# push to quay.ceph.io/ceph/prerelease-$REPO_ARCH
184187
#
185-
version_tag=${repopath}/prerelease-${REPO_ARCH}:v${VERSION}-${builddate}
188+
version_tag=${repopath}:v${VERSION}-${builddate}
186189

187190
podman tag ${image_id} ${version_tag}
188191
if [[ -z "${NO_PUSH}" ]] ; then

0 commit comments

Comments
 (0)