summaryrefslogtreecommitdiff
path: root/.azure-pipelines/commands
diff options
context:
space:
mode:
authorMatt Clay <matt@mystile.com>2023-02-28 13:21:11 -0800
committerMatt Clay <matt@mystile.com>2023-03-14 17:47:58 -0700
commit4461de15deed01cf05486027ac1cf250c51e3dd5 (patch)
treeec14143392d3cb363c7e4f06addc3eb6a468aee4 /.azure-pipelines/commands
parentbea9a2acf72f87661660a0d46c8554777aa02978 (diff)
downloadansible-4461de15deed01cf05486027ac1cf250c51e3dd5.tar.gz
[stable-2.14] Relocate the AZP entry point scripts (#80114)
Scripts previously under `test/utils/shippable/` are now under `.azure-pipelines/commands/` instead. (cherry picked from commit f47bc03599eedc48753d2cd5e1bea177f35e6133) Co-authored-by: Matt Clay <matt@mystile.com>
Diffstat (limited to '.azure-pipelines/commands')
l---------.azure-pipelines/commands/alpine.sh1
-rwxr-xr-x.azure-pipelines/commands/cloud.sh34
-rwxr-xr-x.azure-pipelines/commands/entry-point.sh62
l---------.azure-pipelines/commands/fedora.sh1
l---------.azure-pipelines/commands/freebsd.sh1
l---------.azure-pipelines/commands/galaxy.sh1
-rwxr-xr-x.azure-pipelines/commands/generic.sh18
-rwxr-xr-x.azure-pipelines/commands/i.sh14
l---------.azure-pipelines/commands/incidental/ios.sh1
-rwxr-xr-x.azure-pipelines/commands/incidental/network.sh40
l---------.azure-pipelines/commands/incidental/vyos.sh1
-rwxr-xr-x.azure-pipelines/commands/incidental/windows.sh52
-rwxr-xr-x.azure-pipelines/commands/linux.sh18
l---------.azure-pipelines/commands/macos.sh1
-rwxr-xr-x.azure-pipelines/commands/remote.sh32
l---------.azure-pipelines/commands/rhel.sh1
-rwxr-xr-x.azure-pipelines/commands/sanity.sh27
l---------.azure-pipelines/commands/ubuntu.sh1
-rwxr-xr-x.azure-pipelines/commands/units.sh11
-rwxr-xr-x.azure-pipelines/commands/windows.sh94
20 files changed, 411 insertions, 0 deletions
diff --git a/.azure-pipelines/commands/alpine.sh b/.azure-pipelines/commands/alpine.sh
new file mode 120000
index 0000000000..6ddb776854
--- /dev/null
+++ b/.azure-pipelines/commands/alpine.sh
@@ -0,0 +1 @@
+remote.sh \ No newline at end of file
diff --git a/.azure-pipelines/commands/cloud.sh b/.azure-pipelines/commands/cloud.sh
new file mode 100755
index 0000000000..da037e09e1
--- /dev/null
+++ b/.azure-pipelines/commands/cloud.sh
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+
+set -o pipefail -eux
+
+declare -a args
+IFS='/:' read -ra args <<< "$1"
+
+cloud="${args[0]}"
+python="${args[1]}"
+group="${args[2]}"
+
+target="shippable/${cloud}/group${group}/"
+
+stage="${S:-prod}"
+
+changed_all_target="shippable/${cloud}/smoketest/"
+
+if ! ansible-test integration "${changed_all_target}" --list-targets > /dev/null 2>&1; then
+ # no smoketest tests are available for this cloud
+ changed_all_target="none"
+fi
+
+if [ "${group}" == "1" ]; then
+ # only run smoketest tests for group1
+ changed_all_mode="include"
+else
+ # smoketest tests already covered by group1
+ changed_all_mode="exclude"
+fi
+
+# shellcheck disable=SC2086
+ansible-test integration --color -v --retry-on-error "${target}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} ${UNSTABLE:+"$UNSTABLE"} \
+ --remote-terminate always --remote-stage "${stage}" \
+ --docker --python "${python}" --changed-all-target "${changed_all_target}" --changed-all-mode "${changed_all_mode}"
diff --git a/.azure-pipelines/commands/entry-point.sh b/.azure-pipelines/commands/entry-point.sh
new file mode 100755
index 0000000000..0a9e571be1
--- /dev/null
+++ b/.azure-pipelines/commands/entry-point.sh
@@ -0,0 +1,62 @@
+#!/usr/bin/env bash
+
+set -o pipefail -eux
+
+declare -a args
+IFS='/:' read -ra args <<< "$1"
+
+script="${args[0]}"
+
+test="$1"
+
+docker images
+docker ps
+
+for container in $(docker ps --format '{{.Image}} {{.ID}}' | grep -v -e '^quay.io/ansible/azure-pipelines-test-container:' | sed 's/^.* //'); do
+ docker rm -f "${container}" || true # ignore errors
+done
+
+docker ps
+
+export PATH="${PWD}/bin:${PATH}"
+export PYTHONIOENCODING='utf-8'
+
+if [ -n "${COVERAGE:-}" ]; then
+ # on-demand coverage reporting triggered by setting the COVERAGE environment variable to a non-empty value
+ export COVERAGE="--coverage"
+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)
+ export COVERAGE="--coverage-check"
+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"
+fi
+
+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
+
+if [[ "${COVERAGE:-}" == "--coverage" ]]; then
+ timeout=60
+else
+ timeout=50
+fi
+
+ansible-test env --dump --show --timeout "${timeout}" --color -v
+
+".azure-pipelines/commands/${script}.sh" "${test}"
diff --git a/.azure-pipelines/commands/fedora.sh b/.azure-pipelines/commands/fedora.sh
new file mode 120000
index 0000000000..6ddb776854
--- /dev/null
+++ b/.azure-pipelines/commands/fedora.sh
@@ -0,0 +1 @@
+remote.sh \ No newline at end of file
diff --git a/.azure-pipelines/commands/freebsd.sh b/.azure-pipelines/commands/freebsd.sh
new file mode 120000
index 0000000000..6ddb776854
--- /dev/null
+++ b/.azure-pipelines/commands/freebsd.sh
@@ -0,0 +1 @@
+remote.sh \ No newline at end of file
diff --git a/.azure-pipelines/commands/galaxy.sh b/.azure-pipelines/commands/galaxy.sh
new file mode 120000
index 0000000000..700ad3edcf
--- /dev/null
+++ b/.azure-pipelines/commands/galaxy.sh
@@ -0,0 +1 @@
+cloud.sh \ No newline at end of file
diff --git a/.azure-pipelines/commands/generic.sh b/.azure-pipelines/commands/generic.sh
new file mode 100755
index 0000000000..28eb12688e
--- /dev/null
+++ b/.azure-pipelines/commands/generic.sh
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+
+set -o pipefail -eux
+
+declare -a args
+IFS='/:' read -ra args <<< "$1"
+
+python="${args[1]}"
+
+if [ "${#args[@]}" -gt 2 ]; then
+ target="shippable/generic/group${args[2]}/"
+else
+ target="shippable/generic/"
+fi
+
+# shellcheck disable=SC2086
+ansible-test integration --color -v --retry-on-error "${target}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} ${UNSTABLE:+"$UNSTABLE"} \
+ --docker default --python "${python}"
diff --git a/.azure-pipelines/commands/i.sh b/.azure-pipelines/commands/i.sh
new file mode 100755
index 0000000000..2b3eed038b
--- /dev/null
+++ b/.azure-pipelines/commands/i.sh
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+# Temporary script to support side-by-side testing for incidental code coverage.
+# Once collection migration has been completed the incidental tests can be combined with the regular tests.
+
+set -o pipefail -eux
+
+declare -a args
+IFS='/:' read -ra args <<< "$1"
+
+script="${args[1]}"
+
+IFS='/' test="${args[*]:1}"
+
+".azure-pipelines/commands/incidental/${script}.sh" "${test}"
diff --git a/.azure-pipelines/commands/incidental/ios.sh b/.azure-pipelines/commands/incidental/ios.sh
new file mode 120000
index 0000000000..cad3e41b70
--- /dev/null
+++ b/.azure-pipelines/commands/incidental/ios.sh
@@ -0,0 +1 @@
+network.sh \ No newline at end of file
diff --git a/.azure-pipelines/commands/incidental/network.sh b/.azure-pipelines/commands/incidental/network.sh
new file mode 100755
index 0000000000..1c489f9e31
--- /dev/null
+++ b/.azure-pipelines/commands/incidental/network.sh
@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+
+set -o pipefail -eux
+
+declare -a args
+IFS='/:' read -ra args <<< "$1"
+
+platform="${args[0]}"
+version="${args[1]}"
+python_version="${args[2]}"
+
+target="shippable/${platform}/incidental/"
+
+stage="${S:-prod}"
+provider="${P:-default}"
+
+# python versions to test in order
+# all versions run full tests
+IFS=' ' read -r -a python_versions <<< \
+ "$(PYTHONPATH="${PWD}/test/lib" python -c 'from ansible_test._internal import constants; print(" ".join(constants.CONTROLLER_PYTHON_VERSIONS))')"
+
+if [ "${python_version}" ]; then
+ # limit tests to a single python version
+ python_versions=("${python_version}")
+fi
+
+for python_version in "${python_versions[@]}"; do
+ # terminate remote instances on the final python version tested
+ if [ "${python_version}" = "${python_versions[-1]}" ]; then
+ terminate="always"
+ else
+ terminate="never"
+ fi
+
+ # shellcheck disable=SC2086
+ ansible-test network-integration --color -v --retry-on-error "${target}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} ${UNSTABLE:+"$UNSTABLE"} \
+ --platform "${platform}/${version}" \
+ --docker default --python "${python_version}" \
+ --remote-terminate "${terminate}" --remote-stage "${stage}" --remote-provider "${provider}"
+done
diff --git a/.azure-pipelines/commands/incidental/vyos.sh b/.azure-pipelines/commands/incidental/vyos.sh
new file mode 120000
index 0000000000..cad3e41b70
--- /dev/null
+++ b/.azure-pipelines/commands/incidental/vyos.sh
@@ -0,0 +1 @@
+network.sh \ No newline at end of file
diff --git a/.azure-pipelines/commands/incidental/windows.sh b/.azure-pipelines/commands/incidental/windows.sh
new file mode 100755
index 0000000000..ad77ace726
--- /dev/null
+++ b/.azure-pipelines/commands/incidental/windows.sh
@@ -0,0 +1,52 @@
+#!/usr/bin/env bash
+
+set -o pipefail -eux
+
+declare -a args
+IFS='/:' read -ra args <<< "$1"
+
+version="${args[1]}"
+
+target="shippable/windows/incidental/"
+
+stage="${S:-prod}"
+provider="${P:-default}"
+
+# python version to run full tests on while other versions run minimal tests
+python_default="$(PYTHONPATH="${PWD}/test/lib" python -c 'from ansible_test._internal import constants; print(constants.CONTROLLER_MIN_PYTHON_VERSION)')"
+
+# version to test when only testing a single version
+single_version=2012-R2
+
+# shellcheck disable=SC2086
+ansible-test windows-integration --list-targets -v ${CHANGED:+"$CHANGED"} ${UNSTABLE:+"$UNSTABLE"} > /tmp/explain.txt 2>&1 || { cat /tmp/explain.txt && false; }
+{ grep ' windows-integration: .* (targeted)$' /tmp/explain.txt || true; } > /tmp/windows.txt
+
+if [ -s /tmp/windows.txt ] || [ "${CHANGED:+$CHANGED}" == "" ]; then
+ echo "Detected changes requiring integration tests specific to Windows:"
+ cat /tmp/windows.txt
+
+ echo "Running Windows integration tests for multiple versions concurrently."
+
+ platforms=(
+ --windows "${version}"
+ )
+else
+ echo "No changes requiring integration tests specific to Windows were detected."
+ echo "Running Windows integration tests for a single version only: ${single_version}"
+
+ if [ "${version}" != "${single_version}" ]; then
+ echo "Skipping this job since it is for: ${version}"
+ exit 0
+ fi
+
+ platforms=(
+ --windows "${version}"
+ )
+fi
+
+# shellcheck disable=SC2086
+ansible-test windows-integration --color -v --retry-on-error "${target}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} ${UNSTABLE:+"$UNSTABLE"} \
+ "${platforms[@]}" \
+ --docker default --python "${python_default}" \
+ --remote-terminate always --remote-stage "${stage}" --remote-provider "${provider}"
diff --git a/.azure-pipelines/commands/linux.sh b/.azure-pipelines/commands/linux.sh
new file mode 100755
index 0000000000..9cc2f966cb
--- /dev/null
+++ b/.azure-pipelines/commands/linux.sh
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+
+set -o pipefail -eux
+
+declare -a args
+IFS='/:' read -ra args <<< "$1"
+
+image="${args[1]}"
+
+if [ "${#args[@]}" -gt 2 ]; then
+ target="shippable/posix/group${args[2]}/"
+else
+ target="shippable/posix/"
+fi
+
+# shellcheck disable=SC2086
+ansible-test integration --color -v --retry-on-error "${target}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} ${UNSTABLE:+"$UNSTABLE"} \
+ --docker "${image}"
diff --git a/.azure-pipelines/commands/macos.sh b/.azure-pipelines/commands/macos.sh
new file mode 120000
index 0000000000..6ddb776854
--- /dev/null
+++ b/.azure-pipelines/commands/macos.sh
@@ -0,0 +1 @@
+remote.sh \ No newline at end of file
diff --git a/.azure-pipelines/commands/remote.sh b/.azure-pipelines/commands/remote.sh
new file mode 100755
index 0000000000..b64e0d46fc
--- /dev/null
+++ b/.azure-pipelines/commands/remote.sh
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+
+set -o pipefail -eux
+
+declare -a args
+IFS='/:' read -ra args <<< "$1"
+
+platform="${args[0]}"
+version="${args[1]}"
+pyver=default
+
+# check for explicit python version like 8.3@3.8
+declare -a splitversion
+IFS='@' read -ra splitversion <<< "$version"
+
+if [ "${#splitversion[@]}" -gt 1 ]; then
+ version="${splitversion[0]}"
+ pyver="${splitversion[1]}"
+fi
+
+if [ "${#args[@]}" -gt 2 ]; then
+ target="shippable/posix/group${args[2]}/"
+else
+ target="shippable/posix/"
+fi
+
+stage="${S:-prod}"
+provider="${P:-default}"
+
+# shellcheck disable=SC2086
+ansible-test integration --color -v --retry-on-error "${target}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} ${UNSTABLE:+"$UNSTABLE"} \
+ --python "${pyver}" --remote "${platform}/${version}" --remote-terminate always --remote-stage "${stage}" --remote-provider "${provider}" \
diff --git a/.azure-pipelines/commands/rhel.sh b/.azure-pipelines/commands/rhel.sh
new file mode 120000
index 0000000000..6ddb776854
--- /dev/null
+++ b/.azure-pipelines/commands/rhel.sh
@@ -0,0 +1 @@
+remote.sh \ No newline at end of file
diff --git a/.azure-pipelines/commands/sanity.sh b/.azure-pipelines/commands/sanity.sh
new file mode 100755
index 0000000000..6dc4d1da9a
--- /dev/null
+++ b/.azure-pipelines/commands/sanity.sh
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+
+set -o pipefail -eux
+
+declare -a args
+IFS='/:' read -ra args <<< "$1"
+
+group="${args[1]}"
+
+if [ "${BASE_BRANCH:-}" ]; then
+ base_branch="origin/${BASE_BRANCH}"
+else
+ base_branch=""
+fi
+
+case "${group}" in
+ 1) options=(--skip-test pylint --skip-test ansible-doc --skip-test docs-build --skip-test package-data --skip-test changelog --skip-test validate-modules) ;;
+ 2) options=( --test ansible-doc --test docs-build --test package-data --test changelog) ;;
+ 3) options=(--test pylint --exclude test/units/ --exclude lib/ansible/module_utils/) ;;
+ 4) options=(--test pylint test/units/ lib/ansible/module_utils/) ;;
+ 5) options=( --test validate-modules) ;;
+esac
+
+# shellcheck disable=SC2086
+ansible-test sanity --color -v --junit ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} \
+ --docker --keep-git --base-branch "${base_branch}" \
+ "${options[@]}" --allow-disabled
diff --git a/.azure-pipelines/commands/ubuntu.sh b/.azure-pipelines/commands/ubuntu.sh
new file mode 120000
index 0000000000..6ddb776854
--- /dev/null
+++ b/.azure-pipelines/commands/ubuntu.sh
@@ -0,0 +1 @@
+remote.sh \ No newline at end of file
diff --git a/.azure-pipelines/commands/units.sh b/.azure-pipelines/commands/units.sh
new file mode 100755
index 0000000000..dc115dec15
--- /dev/null
+++ b/.azure-pipelines/commands/units.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+set -o pipefail -eux
+
+declare -a args
+IFS='/:' read -ra args <<< "$1"
+
+version="${args[1]}"
+
+# shellcheck disable=SC2086
+ansible-test units --color -v --docker default --python "${version}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} \
diff --git a/.azure-pipelines/commands/windows.sh b/.azure-pipelines/commands/windows.sh
new file mode 100755
index 0000000000..714588b88b
--- /dev/null
+++ b/.azure-pipelines/commands/windows.sh
@@ -0,0 +1,94 @@
+#!/usr/bin/env bash
+
+set -o pipefail -eux
+
+declare -a args
+IFS='/:' read -ra args <<< "$1"
+
+version="${args[1]}"
+group="${args[2]}"
+
+target="shippable/windows/group${group}/"
+
+stage="${S:-prod}"
+provider="${P:-default}"
+
+# python versions to test in order
+IFS=' ' read -r -a python_versions <<< \
+ "$(PYTHONPATH="${PWD}/test/lib" python -c 'from ansible_test._internal import constants; print(" ".join(constants.CONTROLLER_PYTHON_VERSIONS))')"
+
+# python version to run full tests on while other versions run minimal tests
+python_default="$(PYTHONPATH="${PWD}/test/lib" python -c 'from ansible_test._internal import constants; print(constants.CONTROLLER_MIN_PYTHON_VERSION)')"
+
+# version to test when only testing a single version
+single_version=2012-R2
+
+# shellcheck disable=SC2086
+ansible-test windows-integration --list-targets -v ${CHANGED:+"$CHANGED"} ${UNSTABLE:+"$UNSTABLE"} > /tmp/explain.txt 2>&1 || { cat /tmp/explain.txt && false; }
+{ grep ' windows-integration: .* (targeted)$' /tmp/explain.txt || true; } > /tmp/windows.txt
+
+if [ -s /tmp/windows.txt ] || [ "${CHANGED:+$CHANGED}" == "" ]; then
+ echo "Detected changes requiring integration tests specific to Windows:"
+ cat /tmp/windows.txt
+
+ echo "Running Windows integration tests for multiple versions concurrently."
+
+ platforms=(
+ --windows "${version}"
+ )
+else
+ echo "No changes requiring integration tests specific to Windows were detected."
+ echo "Running Windows integration tests for a single version only: ${single_version}"
+
+ if [ "${version}" != "${single_version}" ]; then
+ echo "Skipping this job since it is for: ${version}"
+ exit 0
+ fi
+
+ platforms=(
+ --windows "${version}"
+ )
+fi
+
+for version in "${python_versions[@]}"; do
+ changed_all_target="all"
+ changed_all_mode="default"
+
+ if [ "${version}" == "${python_default}" ]; then
+ # smoketest tests
+ if [ "${CHANGED}" ]; then
+ # with change detection enabled run tests for anything changed
+ # use the smoketest tests for any change that triggers all tests
+ ci="${target}"
+ changed_all_target="shippable/windows/smoketest/"
+ if [ "${target}" == "shippable/windows/group1/" ]; then
+ # only run smoketest tests for group1
+ changed_all_mode="include"
+ else
+ # smoketest tests already covered by group1
+ changed_all_mode="exclude"
+ fi
+ else
+ # without change detection enabled run entire test group
+ ci="${target}"
+ fi
+ else
+ # only run minimal tests for group1
+ if [ "${target}" != "shippable/windows/group1/" ]; then continue; fi
+ # minimal tests for other python versions
+ ci="shippable/windows/minimal/"
+ fi
+
+ # terminate remote instances on the final python version tested
+ if [ "${version}" = "${python_versions[-1]}" ]; then
+ terminate="always"
+ else
+ terminate="never"
+ fi
+
+ # shellcheck disable=SC2086
+ ansible-test windows-integration --color -v --retry-on-error "${ci}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} ${UNSTABLE:+"$UNSTABLE"} \
+ "${platforms[@]}" --changed-all-target "${changed_all_target}" --changed-all-mode "${changed_all_mode}" \
+ --docker default --python "${version}" \
+ --remote-terminate "${terminate}" --remote-stage "${stage}" --remote-provider "${provider}"
+done