2019-02-18 13:41:45 -08:00
|
|
|
#!/usr/bin/env bash
|
2016-11-29 21:21:53 -08:00
|
|
|
|
2019-02-18 13:41:45 -08:00
|
|
|
set -o pipefail -eux
|
2016-11-29 21:21:53 -08:00
|
|
|
|
|
|
|
declare -a args
|
2017-10-03 12:43:46 -07:00
|
|
|
IFS='/:' read -ra args <<< "$1"
|
2016-11-29 21:21:53 -08:00
|
|
|
|
|
|
|
script="${args[0]}"
|
|
|
|
|
2017-10-03 12:43:46 -07:00
|
|
|
test="$1"
|
|
|
|
|
2021-04-27 15:10:51 -07:00
|
|
|
docker images
|
2016-11-29 21:21:53 -08:00
|
|
|
docker ps
|
|
|
|
|
2021-04-27 15:10:51 -07:00
|
|
|
for container in $(docker ps --format '{{.Image}} {{.ID}}' | grep -v -e '^quay.io/ansible/azure-pipelines-test-container:' | sed 's/^.* //'); do
|
2019-02-21 13:59:56 -08:00
|
|
|
docker rm -f "${container}" || true # ignore errors
|
2018-07-09 21:06:13 -07:00
|
|
|
done
|
|
|
|
|
|
|
|
docker ps
|
|
|
|
|
2019-08-05 14:56:38 -07:00
|
|
|
export PATH="${PWD}/bin:${PATH}"
|
2017-04-08 22:34:29 -07:00
|
|
|
export PYTHONIOENCODING='utf-8'
|
2017-05-14 01:08:42 +08:00
|
|
|
|
2017-05-14 15:04:52 +08:00
|
|
|
if [ -n "${COVERAGE:-}" ]; then
|
|
|
|
# on-demand coverage reporting triggered by setting the COVERAGE environment variable to a non-empty value
|
2017-05-14 01:08:42 +08:00
|
|
|
export COVERAGE="--coverage"
|
2017-05-14 15:04:52 +08:00
|
|
|
elif [[ "${COMMIT_MESSAGE}" =~ ci_coverage ]]; then
|
|
|
|
# on-demand coverage reporting triggered by having 'ci_coverage' in the latest commit message
|
|
|
|
export COVERAGE="--coverage"
|
|
|
|
else
|
|
|
|
# on-demand coverage reporting disabled (default behavior, always-on coverage reporting remains enabled)
|
2019-03-11 15:13:09 -07:00
|
|
|
export COVERAGE="--coverage-check"
|
2017-05-14 15:04:52 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "${COMPLETE:-}" ]; then
|
|
|
|
# disable change detection triggered by setting the COMPLETE environment variable to a non-empty value
|
|
|
|
export CHANGED=""
|
|
|
|
elif [[ "${COMMIT_MESSAGE}" =~ ci_complete ]]; then
|
|
|
|
# disable change detection triggered by having 'ci_complete' in the latest commit message
|
|
|
|
export CHANGED=""
|
|
|
|
else
|
|
|
|
# enable change detection (default behavior)
|
|
|
|
export CHANGED="--changed"
|
2017-05-14 01:08:42 +08:00
|
|
|
fi
|
2016-11-29 21:21:53 -08:00
|
|
|
|
2018-04-12 16:15:28 -07:00
|
|
|
if [ "${IS_PULL_REQUEST:-}" == "true" ]; then
|
|
|
|
# run unstable tests which are targeted by focused changes on PRs
|
|
|
|
export UNSTABLE="--allow-unstable-changed"
|
|
|
|
else
|
|
|
|
# do not run unstable tests outside PRs
|
|
|
|
export UNSTABLE=""
|
|
|
|
fi
|
|
|
|
|
2019-03-11 15:13:09 -07:00
|
|
|
if [[ "${COVERAGE:-}" == "--coverage" ]]; then
|
2019-03-05 11:58:13 -08:00
|
|
|
timeout=60
|
|
|
|
else
|
2019-11-01 08:59:29 -07:00
|
|
|
timeout=50
|
2019-03-05 11:58:13 -08:00
|
|
|
fi
|
|
|
|
|
|
|
|
ansible-test env --dump --show --timeout "${timeout}" --color -v
|
2018-12-20 22:08:57 -08:00
|
|
|
|
2017-10-03 12:43:46 -07:00
|
|
|
"test/utils/shippable/${script}.sh" "${test}"
|