]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
Conditionally add container builds for wip- branches 1378/head
authorDan Mick <dan.mick@redhat.com>
Sat, 24 Aug 2019 04:30:24 +0000 (21:30 -0700)
committerDan Mick <dan.mick@redhat.com>
Thu, 5 Sep 2019 22:53:06 +0000 (15:53 -0700)
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 <dan.mick@redhat.com>
ceph-dev-new-build/build/build_rpm
ceph-dev-new/config/definitions/ceph-dev-new.yml

index 338f62e7334b71783956f1394233d8a266ea82c4..972f1fb05a92588b465ccea82aee3f8d2d593b3b 100644 (file)
@@ -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
index 93ae2c95e0fb14b48ae5ca26c995aceef3e556f1..deae87fb4ef4e47f5104eaf215db90736068f627 100644 (file)
@@ -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'