Debian Codegraph @

.azure-pipelines/commands/entry-point.sh

raw symbols SCIP
1 #!/usr/bin/env bash
2
3 set -o pipefail -eux
4
5 declare -a args
6 IFS='/:' read -ra args <<< "$1"
7
8 script="${args[0]}"
9
10 test="$1"
11
12 docker images
13 docker ps
14
15 for container in $(docker ps --format '{{.Image}} {{.ID}}' | grep -v -e '^quay.io/ansible/azure-pipelines-test-container:' | sed 's/^.* //'); do
16 docker rm -f "${container}" || true # ignore errors
17 done
18
19 docker ps
20
21 export PATH="${PWD}/bin:${PATH}"
22 export PYTHONIOENCODING='utf-8'
23
24 if [ -n "${COVERAGE:-}" ]; then
25 # on-demand coverage reporting triggered by setting the COVERAGE environment variable to a non-empty value
26 export COVERAGE="--coverage"
27 elif [[ "${COMMIT_MESSAGE}" =~ ci_coverage ]]; then
28 # on-demand coverage reporting triggered by having 'ci_coverage' in the latest commit message
29 export COVERAGE="--coverage"
30 else
31 # on-demand coverage reporting disabled (default behavior, always-on coverage reporting remains enabled)
32 export COVERAGE="--coverage-check"
33 fi
34
35 if [ -n "${COMPLETE:-}" ]; then
36 # disable change detection triggered by setting the COMPLETE environment variable to a non-empty value
37 export CHANGED=""
38 elif [[ "${COMMIT_MESSAGE}" =~ ci_complete ]]; then
39 # disable change detection triggered by having 'ci_complete' in the latest commit message
40 export CHANGED=""
41 else
42 # enable change detection (default behavior)
43 export CHANGED="--changed"
44 fi
45
46 if [ "${IS_PULL_REQUEST:-}" == "true" ]; then
47 # run unstable tests which are targeted by focused changes on PRs
48 export UNSTABLE="--allow-unstable-changed"
49 else
50 # do not run unstable tests outside PRs
51 export UNSTABLE=""
52 fi
53
54 if [[ "${COVERAGE:-}" == "--coverage" ]]; then
55 timeout=60
56 else
57 timeout=50
58 fi
59
60 ansible-test env --dump --show --timeout "${timeout}" --color -v
61
62 ".azure-pipelines/commands/${script}.sh" "${test}"