summaryrefslogtreecommitdiffstats
path: root/container/build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'container/build.sh')
-rwxr-xr-xcontainer/build.sh34
1 files changed, 26 insertions, 8 deletions
diff --git a/container/build.sh b/container/build.sh
index 5edf469d2d2..d7712524e4d 100755
--- a/container/build.sh
+++ b/container/build.sh
@@ -22,6 +22,8 @@ CONTAINER_REPO_HOSTNAME (quay.ceph.io, for CI, for instance)
CONTAINER_REPO_ORGANIZATION (ceph-ci, for CI, for instance)
CONTAINER_REPO_USERNAME
CONTAINER_REPO_PASSWORD
+PRERELEASE_USERNAME for download.ceph.com:/prerelease/ceph
+PRERELEASE_PASSWORD
For a release build: (from ceph.git, built and pushed to download.ceph.com)
CI_CONTAINER: must be 'false'
@@ -41,12 +43,17 @@ CEPH_SHA1=${CEPH_SHA1:-$(git rev-parse HEAD)}
# default: build host arch
ARCH=${ARCH:-$(arch)}
if [[ "${ARCH}" == "aarch64" ]] ; then ARCH=arm64; fi
+REPO_ARCH=amd64
+if [[ "${ARCH}" = arm64 ]] ; then
+ REPO_ARCH=arm64
+fi
+
if [[ ${CI_CONTAINER} == "true" ]] ; then
CONTAINER_REPO_HOSTNAME=${CONTAINER_REPO_HOSTNAME:-quay.ceph.io}
- CONTAINER_REPO_ORGANIZATION=${CONTAINER_REPO_ORGANIZATION:-ceph/ceph-${ARCH}}
+ CONTAINER_REPO_ORGANIZATION=${CONTAINER_REPO_ORGANIZATION:-ceph-ci/ceph}
else
- CONTAINER_REPO_HOSTNAME=${CONTAINER_REPO_HOSTNAME:-quay.io}
- CONTAINER_REPO_ORGANIZATION=${CONTAINER_REPO_ORGANIZATION:-ceph/ceph}
+ CONTAINER_REPO_HOSTNAME=${CONTAINER_REPO_HOSTNAME:-quay.ceph.io}
+ CONTAINER_REPO_ORGANIZATION=${CONTAINER_REPO_ORGANIZATION:-ceph/prerelease-${REPO_ARCH}}
# default: most-recent annotated tag
VERSION=${VERSION:-$(git describe --abbrev=0)}
fi
@@ -61,7 +68,7 @@ fi
: "${CONTAINER_REPO_ORGANIZATION:?}"
: "${CONTAINER_REPO_USERNAME:?}"
: "${CONTAINER_REPO_PASSWORD:?}"
-if [[ ${CI_CONTAINER} != "true" ]] ; then ${VERSION:?}; fi
+if [[ ${CI_CONTAINER} != "true" ]] ; then : "${VERSION:?}"; fi
# check for valid repo auth (if pushing)
ORGURL=${CONTAINER_REPO_HOSTNAME}/${CONTAINER_REPO_ORGANIZATION}
@@ -87,6 +94,14 @@ fi
# BRANCH will be, say, origin/main. remove <remote>/
BRANCH=${BRANCH##*/}
+# podman build only supports secret files.
+# This must be removed after podman build
+touch prerelease.secret.txt
+chmod 600 prerelease.secret.txt
+echo -e "\
+ PRERELEASE_USERNAME=${PRERELEASE_USERNAME}\n
+ PRERELEASE_PASSWORD=${PRERELEASE_PASSWORD}\n " > prerelease.secret.txt
+
podman build --pull=newer --squash -f $CFILE -t build.sh.output \
--build-arg FROM_IMAGE=${FROM_IMAGE:-quay.io/centos/centos:stream9} \
--build-arg CEPH_SHA1=${CEPH_SHA1} \
@@ -94,8 +109,11 @@ podman build --pull=newer --squash -f $CFILE -t build.sh.output \
--build-arg CEPH_REF=${BRANCH:-main} \
--build-arg OSD_FLAVOR=${FLAVOR:-default} \
--build-arg CI_CONTAINER=${CI_CONTAINER:-default} \
+ --secret=id=prerelease_creds,src=./prerelease.secret.txt \
2>&1
+rm ./prerelease.secret.txt
+
image_id=$(podman image ls localhost/build.sh.output --format '{{.ID}}')
# grab useful image attributes for building the tag
@@ -124,7 +142,7 @@ eval ${vars}
fromtag=${CEPH_CONTAINER_FROM_IMAGE##*/}
# translate : to -
fromtag=${fromtag/:/-}
-builddate=$(date +%Y%m%d)
+builddate=$(date -u +%Y%m%d)
local_tag=${fromtag}-${CEPH_CONTAINER_CEPH_REF}-${CEPH_CONTAINER_ARCH}-${builddate}
repopath=${CONTAINER_REPO_HOSTNAME}/${CONTAINER_REPO_ORGANIZATION}
@@ -162,13 +180,13 @@ if [[ ${CI_CONTAINER} == "true" ]] ; then
else
#
# non-CI build. Tags are like v19.1.0-20240701
- # push to quay.ceph.io/ceph/prerelease
+ # push to quay.ceph.io/ceph/prerelease-$REPO_ARCH
#
- version_tag=${repopath}/prerelease/ceph-${ARCH}:${VERSION}-${builddate}
+ version_tag=${repopath}/prerelease-${REPO_ARCH}:v${VERSION}-${builddate}
podman tag ${image_id} ${version_tag}
if [[ -z "${NO_PUSH}" ]] ; then
- podman push ${image_id} ${version_tag}
+ podman push ${version_tag}
fi
fi