Debian Codegraph @

ansible_collections/community/windows/.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 ansible_version="${args[0]}"
9 script="${args[1]}"
10
11 function join {
12 local IFS="$1";
13 shift;
14 echo "$*";
15 }
16
17 test="$(join / "${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}}' | grep -v -e '^drydock/' -e '^quay.io/ansible/azure-pipelines-test-container:' | sed 's/^.* //'); do
24 docker rm -f "${container}" || true # ignore errors
25 done
26
27 docker ps
28
29 command -v python
30 python -V
31
32 function 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 [ ${result} == 0 ]; then
41 return ${result}
42 fi
43 echo "@* -> ${result}"
44 done
45 echo "Command '@*' failed 3 times!"
46 exit 1
47 }
48
49 command -v pip
50 pip --version
51 pip list --disable-pip-version-check
52 if [ "${ansible_version}" == "devel" ]; then
53 retry pip install https://github.com/ansible/ansible/archive/devel.tar.gz --disable-pip-version-check
54 else
55 retry pip install "https://github.com/ansible/ansible/archive/stable-${ansible_version}.tar.gz" --disable-pip-version-check
56 fi
57
58 sudo chown "$(whoami)" "${PWD}/../../"
59
60 export PYTHONIOENCODING='utf-8'
61
62 if [ -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 [ -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 [ "${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}"