]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ceph_ansible: check if tox env is defined 1239/head
authorGuillaume Abrioux <gabrioux@redhat.com>
Thu, 24 Jan 2019 15:20:48 +0000 (16:20 +0100)
committerGuillaume Abrioux <gabrioux@redhat.com>
Fri, 25 Jan 2019 09:23:08 +0000 (10:23 +0100)
tox allows to run even if an env doesn't match all the factors in the
full name.
This commits check that the desired environment is well defined in
envlist.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
scripts/build_utils.sh

index c464c1495a348cefcb1c351060608dd96824c4a7..de9c33b18e4f5343c43ab87360ebc88e8b539c98 100644 (file)
@@ -750,10 +750,21 @@ function build_job_name() {
   echo "${job_name}"
 }
 
+# shellcheck disable=SC2153
+ENV_NAME="$(build_job_name "$RELEASE" "$DISTRIBUTION" "$DEPLOYMENT" "$SCENARIO")"
+
+for tox_env in $("$VENV"/tox -l)
+do
+  if [[ "$ENV_NAME" == "$tox_env" ]]; then
 # shellcheck disable=SC2116
-if ! eval "$(echo "${TOX_RUN_ENV[@]}")" "$VENV"/tox --workdir="$TEMPVENV" -v -e="$(build_job_name $RELEASE $DISTRIBUTION $DEPLOYMENT $SCENARIO)" -- --provider=libvirt; then echo "ERROR: Job didn't complete successfully or got stuck for more than 3h."
-  exit 1
-fi
+    if ! eval "$(echo "${TOX_RUN_ENV[@]}")" "$VENV"/tox --workdir="$TEMPVENV" -v -e="$ENV_NAME" -- --provider=libvirt; then echo "ERROR: Job didn't complete successfully or got stuck for more than 3h."
+      exit 1
+    fi
+    return 0
+  fi
+done
+echo "ERROR: Environment $ENV_NAME is not defined in tox.ini!"
+exit 1
 }
 
 github_status_setup() {