]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ceph-ansible: PRs should keep CEPH_DOCKER_IMAGE_TAG set in tox 945/head
authorGuillaume Abrioux <gabrioux@redhat.com>
Tue, 16 Jan 2018 09:36:28 +0000 (10:36 +0100)
committerGuillaume Abrioux <gabrioux@redhat.com>
Tue, 16 Jan 2018 12:40:15 +0000 (13:40 +0100)
Setting this variable was originally for nightlies test need.
We should keep `CEPH_DOCKER_IMAGE_TAG` set in tox for PRs.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
ceph-ansible-nightly/build/build
ceph-ansible-prs/build/build
scripts/build_utils.sh

index d46036850bc37d9ec9985bbe475628a5d00245ba..aed376f1bb33f4494b376bfb7a8aae61989de0a8 100644 (file)
@@ -15,10 +15,10 @@ restart_libvirt_services
 update_vagrant_boxes
 
 if [ "$RELEASE" == 'jewel' ] && [ "$CEPH_ANSIBLE_BRANCH" == 'stable-2.2' -o "$CEPH_ANSIBLE_BRANCH" == 'stable-3.0' ]; then
-  start_tox tag-stable-3.0-jewel-centos-7
+  start_tox CEPH_DOCKER_IMAGE_TAG=tag-stable-3.0-jewel-centos-7
 elif [ "$RELEASE" == 'luminous' ] && [ "$CEPH_ANSIBLE_BRANCH" == 'stable-3.0' ]; then
   # start_tox(): <CEPH_DOCKER_IMAGE_TAG> <CEPH_STABLE_RELEASE>
-  start_tox tag-stable-3.0-luminous-centos-7
+  start_tox CEPH_DOCKER_IMAGE_TAG=tag-stable-3.0-luminous-centos-7
 elif [ "$RELEASE" == 'luminous' ] && [ "$CEPH_ANSIBLE_BRANCH" == 'master' ]; then
-  start_tox tag-build-master-luminous-ubuntu-16.04
+  start_tox CEPH_DOCKER_IMAGE_TAG=tag-build-master-luminous-ubuntu-16.04
 fi
index 696de61758867ec0fff84692acea92b65ae28ac7..fdcff5aa5d2ff8ade26398a02b63de993b5a38b8 100644 (file)
@@ -26,10 +26,4 @@ for scenario in $scenarios; do
 done
 popd
 
-if [ "$RELEASE" == 'jewel' ]; then
-  start_tox tag-build-master-jewel-ubuntu-16.04
-elif [ "$RELEASE" == 'luminous' ]; then
-  start_tox tag-build-master-luminous-ubuntu-16.04
-else
-  start_tox latest
-fi
+start_tox
index 690ca036294d3798539d2965e47a087282135ef9..5639f1c2200f7a98b5ce364403db710a27224636 100644 (file)
@@ -596,11 +596,34 @@ update_vagrant_boxes() {
 }
 
 start_tox() {
-# $1 = CEPH_DOCKER_IMAGE_TAG
 # the $SCENARIO var is injected by the job template. It maps
 # to an actual, defined, tox environment
-local release=${2:-$RELEASE}
-  if ! CEPH_DOCKER_IMAGE_TAG=$1 CEPH_STABLE_RELEASE=$RELEASE timeout 3h $VENV/tox -rv -e=$RELEASE-$ANSIBLE_VERSION-$SCENARIO --workdir=$WORKDIR -- --provider=libvirt; then echo "ERROR: Job didn't complete successfully or got stuck for more than 3h."
-    exit 1
-  fi
+while true; do
+  case $1 in
+    CEPH_DOCKER_IMAGE_TAG=?*)
+      local ceph_docker_image_tag=${1#*=}
+      shift
+      ;;
+    RELEASE=?*)
+      local release=${1#*=}
+      shift
+      ;;
+    *)
+      break
+      ;;
+  esac
+done
+TOX_RUN_ENV=("timeout 3h")
+if [ -n "$ceph_docker_image_tag" ]; then
+  TOX_RUN_ENV=("CEPH_DOCKER_IMAGE_TAG=$ceph_docker_image_tag" "${TOX_RUN_ENV[@]}")
+fi
+if [ -n "$release" ]; then
+  TOX_RUN_ENV=("CEPH_STABLE_RELEASE=$release" "${TOX_RUN_ENV[@]}")
+else
+  TOX_RUN_ENV=("CEPH_STABLE_RELEASE=$RELEASE" "${TOX_RUN_ENV[@]}")
+fi
+# shellcheck disable=SC2116
+if ! eval "$(echo "${TOX_RUN_ENV[@]}")" "$VENV"/tox -rv -e="$RELEASE"-"$ANSIBLE_VERSION"-"$SCENARIO" --workdir="$WORKDIR" -- --provider=libvirt; then echo "ERROR: Job didn't complete successfully or got stuck for more than 3h."
+  exit 1
+fi
 }