# (optional) Should be 'true' for CI builds (pull from shaman, etc.)
ARG CI_CONTAINER="true"
-# creds for accessing prerelease packages on download.ceph.com for release builds
-ARG PRERELEASE_USERNAME ""
-ARG PRERELEASE_PASSWORD ""
RUN /bin/echo -e "\
FROM_IMAGE: ${FROM_IMAGE}\n\
esac
# Ceph repo
-RUN set -ex && \
+RUN --mount=type=secret,id=prerelease_creds set -ex && \
rpm --import 'https://download.ceph.com/keys/release.asc' && \
ARCH=$(arch); if [ "${ARCH}" == "aarch64" ]; then ARCH="arm64"; fi ;\
IS_RELEASE=0 ;\
REPO_URL=$(curl -fs "https://shaman.ceph.com/api/search/?project=ceph&distros=centos/9/${ARCH}&flavor=${OSD_FLAVOR}&ref=${CEPH_REF}&sha1=latest" | jq -r .[0].url) ;\
else \
IS_RELEASE=1 ;\
+ source /run/secrets/prerelease_creds; \
REPO_URL="https://${PRERELEASE_USERNAME}:${PRERELEASE_PASSWORD}@download.ceph.com/prerelease/ceph/rpm-${CEPH_REF}/el9/" ;\
fi && \
rpm -Uvh "$REPO_URL/noarch/ceph-release-1-${IS_RELEASE}.el9.noarch.rpm" ; \
if [[ "$IS_RELEASE" == 1 ]] ; then \
- sed -i "s;http://download.ceph.com/;https://${PRERELEASE_USERNAME}:${PRERELEASE_PASSWORD}@download.ceph.com/prerelease/ceph/;" /etc/yum.repos.d/ceph.repo ; \
- dnf clean expire-cache ; \
+ sed -i "s;http://download.ceph.com/;https://${PRERELEASE_USERNAME}:${PRERELEASE_PASSWORD}@download.ceph.com/prerelease/ceph/;" /etc/yum.repos.d/ceph.repo ; \
+ dnf clean expire-cache ; \
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} \
--build-arg CEPH_REF=${BRANCH:-main} \
--build-arg OSD_FLAVOR=${FLAVOR:-default} \
--build-arg CI_CONTAINER=${CI_CONTAINER:-default} \
- --build-arg PRERELEASE_USERNAME=${PRERELEASE_USERNAME} \
- --build-arg PRERELEASE_PASSWORD=${PRERELEASE_PASSWORD} \
+ --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