| 1 | #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash |
| 2 | |
| 3 | set -o pipefail -eux |
| 4 | |
| 5 | declare -a args |
| 6 | IFS='/:scip-shell filesystem . . `/:`.' read -ra args <<< "$1" |
| 7 | |
| 8 | ansible_version="${args[0]}" |
| 9 | script="${args[1]}" |
| 10 | |
| 11 | function joinscip-shell shell ansible 14.0.0+dfsg-1 join(). { |
| 12 | local IFS="$1"; |
| 13 | shift; |
| 14 | echoscip-shell system . . echo. "$*"; |
| 15 | } |
| 16 | |
| 17 | test="$(joinscip-shell shell ansible 14.0.0+dfsg-1 join(). /scip-shell filesystem . . `/`. "${args[@]:1}")" |
| 18 | |
| 19 | docker images ansible/ansible |
| 20 | docker images quay.io/ansible/* |
| 21 | docker ps |
| 22 | |
| 23 | for container in $(docker ps --format '{{.Image}} {{.ID}}' | grepscip-shell system . . grep. -v -e '^drydock/' -e '^quay.io/ansible/azure-pipelines-test-container:' | sedscip-shell system . . sed. 's/^.* //'); do |
| 24 | docker rm -f "${container}" || truescip-shell system . . true. # ignore errors |
| 25 | done |
| 26 | |
| 27 | docker ps |
| 28 | |
| 29 | command -v python |
| 30 | python -V |
| 31 | |
| 32 | function retryscip-shell shell ansible 14.0.0+dfsg-1 retry(). |
| 33 | { |
| 34 | # shellcheck disable=SC2034 |
| 35 | for repetition in 1 2 3; do |
| 36 | set +e |
| 37 | "$@" |
| 38 | result=$? |
| 39 | set -e |
| 40 | if [scip-shell system . . `[`. ${result} == 0 ]; then |
| 41 | return ${result} |
| 42 | fi |
| 43 | echoscip-shell system . . echo. "@* -> ${result}" |
| 44 | done |
| 45 | echoscip-shell system . . echo. "Command '@*' failed 3 times!" |
| 46 | exit 1 |
| 47 | } |
| 48 | |
| 49 | command -v pip |
| 50 | pipscip-shell system . . pip. --version |
| 51 | pipscip-shell system . . pip. list --disable-pip-version-check |
| 52 | if [scip-shell system . . `[`. "${ansible_version}" == "devel" ]; then |
| 53 | retryscip-shell shell ansible 14.0.0+dfsg-1 retry(). pip install https://github.com/ansible/ansible/archive/devel.tar.gz --disable-pip-version-check |
| 54 | else |
| 55 | retryscip-shell shell ansible 14.0.0+dfsg-1 retry(). pip install "https://github.com/ansible/ansible/archive/stable-${ansible_version}.tar.gz" --disable-pip-version-check |
| 56 | fi |
| 57 | |
| 58 | sudoscip-shell system . . sudo. chown "$(whoamiscip-shell system . . whoami.)" "${PWD}/../../" |
| 59 | |
| 60 | export PYTHONIOENCODING='utf-8' |
| 61 | |
| 62 | if [scip-shell system . . `[`. -n "${COVERAGE:-}" ]; then |
| 63 | # on-demand coverage reporting triggered by setting the COVERAGE environment variable to a non-empty value |
| 64 | export COVERAGE="--coverage" |
| 65 | elif [[ "${COMMIT_MESSAGE}" =~ ci_coverage ]]; then |
| 66 | # on-demand coverage reporting triggered by having 'ci_coverage' in the latest commit message |
| 67 | export COVERAGE="--coverage" |
| 68 | else |
| 69 | # on-demand coverage reporting disabled (default behavior, always-on coverage reporting remains enabled) |
| 70 | export COVERAGE="--coverage-check" |
| 71 | fi |
| 72 | |
| 73 | if [scip-shell system . . `[`. -n "${COMPLETE:-}" ]; then |
| 74 | # disable change detection triggered by setting the COMPLETE environment variable to a non-empty value |
| 75 | export CHANGED="" |
| 76 | elif [[ "${COMMIT_MESSAGE}" =~ ci_complete ]]; then |
| 77 | # disable change detection triggered by having 'ci_complete' in the latest commit message |
| 78 | export CHANGED="" |
| 79 | else |
| 80 | # enable change detection (default behavior) |
| 81 | export CHANGED="--changed" |
| 82 | fi |
| 83 | |
| 84 | if [scip-shell system . . `[`. "${IS_PULL_REQUEST:-}" == "true" ]; then |
| 85 | # run unstable tests which are targeted by focused changes on PRs |
| 86 | export UNSTABLE="--allow-unstable-changed" |
| 87 | else |
| 88 | # do not run unstable tests outside PRs |
| 89 | export UNSTABLE="" |
| 90 | fi |
| 91 | |
| 92 | if [[ "${COVERAGE:-}" == "--coverage" ]]; then |
| 93 | timeout=60 |
| 94 | else |
| 95 | timeout=50 |
| 96 | fi |
| 97 | |
| 98 | ansible-test env --dump --show --timeout "${timeout}" --color -v |
| 99 | |
| 100 | ".azure-pipelines/commands/${script}.sh" "${test}" |