Apex: Fix functest docker tag passing for gate
[releng.git] / jjb / apex / apex-functest-scenario.sh
1 #!/bin/bash
2 set -o errexit
3 set -o nounset
4 set -o pipefail
5
6 features=$(echo $DEPLOY_SCENARIO | sed -r -n 's/os-.+-(.+)-(noha|ha)/\1/p')
7 if [ "$features" == 'rocky' ]; then
8   functest_scenario=$(echo $DEPLOY_SCENARIO | sed -r -n 's/(os-.+?)-rocky-(noha|ha)/\1-nofeature-\2/p')
9   echo "DOCKER_TAG=hunter" > functest_scenario
10 elif [[ "$features" =~ 'rocky' ]]; then
11   functest_scenario=$(echo $DEPLOY_SCENARIO | sed -r -n 's/(os-.+?)-(.+)_rocky-(noha|ha)/\1-\2-\3/p')
12   echo "DOCKER_TAG=hunter" > functest_scenario
13 else
14   functest_scenario=$(echo $DEPLOY_SCENARIO | sed -r -n 's/-(noha|ha).*/-\1/p')
15   echo "DOCKER_TAG=$([[ ${BRANCH##*/} == "master" ]] && \
16     echo "latest" || echo ${BRANCH##*/})" > functest_scenario
17 fi
18 echo "DEPLOY_SCENARIO=$functest_scenario" >> functest_scenario