From: Dan Mick Date: Sat, 24 Aug 2019 04:30:24 +0000 (-0700) Subject: Conditionally add container builds for wip- branches X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=104f9ffede65405d9d978ad3f5579c8afe1f5cda;p=ceph-build.git Conditionally add container builds for wip- branches New parameter CI_CONTAINER ('true' or 'false') controls behavior; if set to 'true', ceph-container.git will be used to build a centos7 daemon-base default flavor container and push it to a repo server. This requires waiting until the shaman repo is built. New parameters CONTAINER_REPO_{HOSTNAME, ORGANIZATION} set where to push the resultant container. If repo doesn't become ready or if the actual build/push fails, don't fail the overall build. Maybe we can come up with a better way to indicate this than just a log notation Signed-off-by: Dan Mick --- diff --git a/ceph-dev-new-build/build/build_rpm b/ceph-dev-new-build/build/build_rpm index 338f62e7..972f1fb0 100644 --- a/ceph-dev-new-build/build/build_rpm +++ b/ceph-dev-new-build/build/build_rpm @@ -2,6 +2,11 @@ set -ex +# set to "true" or "false" so that both string comparisons +# and 'if $CI_CONTAINER' work as expected. Conventions vary across the +# set of shell scripts and repos involved. +CI_CONTAINER=${CI_CONTAINER:-false} + # create a release directory for ceph-build tools mkdir -p release cp -a dist release/${vers} @@ -180,5 +185,29 @@ EOF echo Check the status of the repo at: https://shaman.ceph.com/api/repos/${chacra_endpoint}/flavors/${FLAVOR}/ fi +# XXX perhaps use job parameters instead of literals; then +# later stages can also use them to compare etc. +if [[ $CI_CONTAINER == "true" && $DISTRO == "centos" && $RELEASE == "7" && $FLAVOR == "default" ]] ; then + loop=0 + ready=false + while ((loop < 15)); do + if [[ $(curl -s https://shaman.ceph.com/api/repos/${chacra_endpoint}/flavors/${FLAVOR}/ | jq '.[0].status') == '"ready"' ]] ; then ready=true; break; fi + ((loop = loop + 1)) + sleep 60 + done + + if [[ "$ready" == "false" ]] ; then + echo "FAIL: timed out waiting for shaman repo to be built: https://shaman.ceph.com/api/repos/${chacra_endpoint}/flavors/${FLAVOR}/" + # don't fail the build here on purpose + # update_build_status "failed" "ceph" $NORMAL_DISTRO $NORMAL_DISTRO_VERSION $NORMAL_ARCH + # exit 1 + fi + + cd $WORKSPACE/ceph-container + # avoid failing the build if build-push fails + CI_CONTAINER=${CI_CONTAINER} SHA1=${SHA1} /bin/bash ./contrib/build-push-ceph-container-imgs.sh || /bin/true + cd $WORKSPACE +fi + # update shaman with the completed build status update_build_status "completed" "ceph" $NORMAL_DISTRO $NORMAL_DISTRO_VERSION $NORMAL_ARCH diff --git a/ceph-dev-new/config/definitions/ceph-dev-new.yml b/ceph-dev-new/config/definitions/ceph-dev-new.yml index 93ae2c95..deae87fb 100644 --- a/ceph-dev-new/config/definitions/ceph-dev-new.yml +++ b/ceph-dev-new/config/definitions/ceph-dev-new.yml @@ -60,11 +60,26 @@ If this is checked, then the binaries will be built and pushed to chacra even if default: "default" description: "Type of Ceph build, choices are: crimson, notcmalloc, default (i.e. with tcmalloc). Defaults to: 'default'" + - string: + name: CI_CONTAINER + description: 'Build container with development release of Ceph. Note: this must be "false" or "true" so that it can execute a command or satisfy a string comparison' + default: "true" + - string: name: CONTAINER_BRANCH description: "For CI_CONTAINER: Branch of ceph-container to use" default: master + - string: + name: CONTAINER_REPO_HOSTNAME + description: "For CI_CONTAINER: Name of container repo server (i.e. 'quay.io')" + default: "quay.io" + + - string: + name: CONTAINER_REPO_ORGANIZATION + description: "For CI_CONTAINER: Name of container repo organization (i.e. 'cephci')" + default: "cephci" + builders: - multijob: name: 'ceph dev setup phase'