1
0
Fork 0
mirror of https://github.com/ansible-collections/hetzner.hcloud.git synced 2026-02-04 08:01:49 +00:00

Initial Azure Pipelines configuration

This commit is contained in:
John Barker 2021-02-03 11:40:48 +00:00
parent c8b502dba1
commit 68241982ed
15 changed files with 496 additions and 89 deletions

View file

@ -14,31 +14,14 @@ else
fi
if [ "${group}" == "extra" ]; then
pip install antsibull-changelog
python ../../community/internal_test_tools/tools/run.py --color
# ansible-galaxy -vvv collection install community.internal_test_tools
git clone --single-branch --depth 1 https://github.com/ansible-collections/community.internal_test_tools.git ../../community/internal_test_tools
../internal_test_tools/tools/run.py --color
exit
fi
case "${group}" in
1) options=(--skip-test pylint --skip-test ansible-doc --skip-test validate-modules) ;;
2) options=( --test ansible-doc --test validate-modules) ;;
3) options=(--test pylint plugins/modules/) ;;
4) options=(--test pylint --exclude plugins/modules/) ;;
esac
# allow collection migration sanity tests for groups 3 and 4 to pass without updating this script during migration
network_path="lib/ansible/modules/network/"
if [ -d "${network_path}" ]; then
if [ "${group}" -eq 3 ]; then
options+=(--exclude "${network_path}")
elif [ "${group}" -eq 4 ]; then
options+=("${network_path}")
fi
fi
# shellcheck disable=SC2086
ansible-test sanity --color -v --junit ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} \
--docker --base-branch "${base_branch}" \
--exclude shippable.yml --exclude tests/utils/ \
"${options[@]}" --allow-disabled
--allow-disabled

View file

@ -14,13 +14,15 @@ function join {
echo "$*";
}
test="$(join / "${args[@]:1}")"
# Ensure we can write other collections to this dir
sudo chown "$(whoami)" "${PWD}/../../"
test="$(join / "${args[@]:1}")"
docker images ansible/ansible
docker images quay.io/ansible/*
docker ps
for container in $(docker ps --format '{{.Image}} {{.ID}}' | grep -v '^drydock/' | sed 's/^.* //'); do
for container in $(docker ps --format '{{.Image}} {{.ID}}' | grep -v -e '^drydock/' -e '^quay.io/ansible/azure-pipelines-test-container:' | sed 's/^.* //'); do
docker rm -f "${container}" || true # ignore errors
done
@ -35,6 +37,7 @@ python -V
function retry
{
# shellcheck disable=SC2034
for repetition in 1 2 3; do
set +e
"$@"
@ -43,7 +46,7 @@ function retry
if [ ${result} == 0 ]; then
return ${result}
fi
echo "$@ -> ${result}"
echo "@* -> ${result}"
done
echo "Command '$@' failed 3 times!"
exit -1
@ -57,12 +60,16 @@ if [ "${ansible_version}" == "devel" ]; then
else
retry pip install "https://github.com/ansible/ansible/archive/stable-${ansible_version}.tar.gz" --disable-pip-version-check
fi
export ANSIBLE_COLLECTIONS_PATHS="${HOME}/.ansible"
SHIPPABLE_RESULT_DIR="$(pwd)/shippable"
TEST_DIR="${ANSIBLE_COLLECTIONS_PATHS}/ansible_collections/hetzner/hcloud"
mkdir -p "${TEST_DIR}"
cp -aT "${SHIPPABLE_BUILD_DIR}" "${TEST_DIR}"
cd "${TEST_DIR}"
if [ "${SHIPPABLE_BUILD_ID:-}" ]; then
export ANSIBLE_COLLECTIONS_PATHS="${HOME}/.ansible"
SHIPPABLE_RESULT_DIR="$(pwd)/shippable"
TEST_DIR="${ANSIBLE_COLLECTIONS_PATHS}/ansible_collections/hetzner/hcloud"
mkdir -p "${TEST_DIR}"
cp -aT "${SHIPPABLE_BUILD_DIR}" "${TEST_DIR}"
cd "${TEST_DIR}"
else
export ANSIBLE_COLLECTIONS_PATHS="${PWD}/../../../"
fi
# STAR: HACK install dependencies
retry ansible-galaxy -vvv collection install community.general
@ -117,9 +124,9 @@ function cleanup
fi
}
trap cleanup EXIT
if [ "${SHIPPABLE_BUILD_ID:-}" ]; then trap cleanup EXIT; fi
ansible-test env --dump --show --timeout "50" --color -v
"tests/utils/shippable/check_matrix.py"
if [ "${SHIPPABLE_BUILD_ID:-}" ]; then "tests/utils/shippable/check_matrix.py"; fi
"tests/utils/shippable/${script}.sh" "${test}"