summaryrefslogtreecommitdiffstats
path: root/ansible_collections/hetzner/hcloud/.azure-pipelines
diff options
context:
space:
mode:
Diffstat (limited to 'ansible_collections/hetzner/hcloud/.azure-pipelines')
-rw-r--r--ansible_collections/hetzner/hcloud/.azure-pipelines/azure-pipelines.yml184
-rwxr-xr-xansible_collections/hetzner/hcloud/.azure-pipelines/scripts/aggregate-coverage.sh8
-rwxr-xr-xansible_collections/hetzner/hcloud/.azure-pipelines/scripts/combine-coverage.py27
-rwxr-xr-xansible_collections/hetzner/hcloud/.azure-pipelines/scripts/publish-codecov.sh26
-rwxr-xr-xansible_collections/hetzner/hcloud/.azure-pipelines/scripts/report-coverage.sh10
-rwxr-xr-xansible_collections/hetzner/hcloud/.azure-pipelines/scripts/run-tests.sh24
-rwxr-xr-xansible_collections/hetzner/hcloud/.azure-pipelines/scripts/time-command.py11
-rw-r--r--ansible_collections/hetzner/hcloud/.azure-pipelines/templates/matrix.yml14
-rw-r--r--ansible_collections/hetzner/hcloud/.azure-pipelines/templates/test.yml68
9 files changed, 220 insertions, 152 deletions
diff --git a/ansible_collections/hetzner/hcloud/.azure-pipelines/azure-pipelines.yml b/ansible_collections/hetzner/hcloud/.azure-pipelines/azure-pipelines.yml
index d55524f27..8300381b4 100644
--- a/ansible_collections/hetzner/hcloud/.azure-pipelines/azure-pipelines.yml
+++ b/ansible_collections/hetzner/hcloud/.azure-pipelines/azure-pipelines.yml
@@ -1,22 +1,20 @@
trigger:
batch: true
branches:
- include:
- - main
+ include: [main, stable-1]
pr:
autoCancel: true
+ drafts: false
branches:
- include:
- - main
+ include: [main, stable-1]
schedules:
- cron: 0 9 * * *
displayName: Nightly
always: true
branches:
- include:
- - main
+ include: [main, stable-1]
variables:
- name: checkoutPath
@@ -26,20 +24,20 @@ variables:
- name: pipelinesCoverage
value: coverage
- name: entryPoint
- value: tests/utils/shippable/shippable.sh
+ value: tests/utils/ci.sh
- name: fetchDepth
value: 0
resources:
containers:
- container: default
- image: quay.io/ansible/azure-pipelines-test-container:3.0.0
+ image: quay.io/ansible/azure-pipelines-test-container:4.0.1
pool: Standard
stages:
-### Sanity
- - stage: Ansible_devel
+ ### Sanity
+ - stage: Sanity_devel
displayName: Sanity devel
dependsOn: []
jobs:
@@ -47,9 +45,29 @@ stages:
parameters:
targets:
- name: Sanity
- test: 'devel/sanity/1'
+ test: devel/sanity
- - stage: Ansible_2_14
+ - stage: Sanity_2_16
+ displayName: Sanity 2.16
+ dependsOn: []
+ jobs:
+ - template: templates/matrix.yml
+ parameters:
+ targets:
+ - name: Sanity
+ test: 2.16/sanity
+
+ - stage: Sanity_2_15
+ displayName: Sanity 2.15
+ dependsOn: []
+ jobs:
+ - template: templates/matrix.yml
+ parameters:
+ targets:
+ - name: Sanity
+ test: 2.15/sanity
+
+ - stage: Sanity_2_14
displayName: Sanity 2.14
dependsOn: []
jobs:
@@ -57,8 +75,9 @@ stages:
parameters:
targets:
- name: Sanity
- test: '2.14/sanity/1'
- - stage: Ansible_2_13
+ test: 2.14/sanity
+
+ - stage: Sanity_2_13
displayName: Sanity 2.13
dependsOn: []
jobs:
@@ -66,82 +85,133 @@ stages:
parameters:
targets:
- name: Sanity
- test: '2.13/sanity/1'
- - stage: Ansible_2_12
- displayName: Sanity 2.12
+ test: 2.13/sanity
+
+ ### Units
+ - stage: Units_devel
+ displayName: Units devel
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
targets:
- - name: Sanity
- test: '2.12/sanity/1'
+ - name: (py3.12)
+ test: devel/units/3.12
+
+ - stage: Units_2_16
+ displayName: Units 2.16
+ dependsOn: []
+ jobs:
+ - template: templates/matrix.yml
+ parameters:
+ targets:
+ - name: (py3.10)
+ test: 2.16/units/3.10
+ - stage: Units_2_15
+ displayName: Units 2.15
+ dependsOn: []
+ jobs:
+ - template: templates/matrix.yml
+ parameters:
+ targets:
+ - name: (py3.9)
+ test: 2.15/units/3.9
+
+ - stage: Units_2_14
+ displayName: Units 2.14
+ dependsOn: []
+ jobs:
+ - template: templates/matrix.yml
+ parameters:
+ targets:
+ - name: (py3.9)
+ test: 2.14/units/3.9
+
+ - stage: Units_2_13
+ displayName: Units 2.13
+ dependsOn: []
+ jobs:
+ - template: templates/matrix.yml
+ parameters:
+ targets:
+ - name: (py3.8)
+ test: 2.13/units/3.8
+
+ ## Integration
+ - stage: Integration_devel
+ displayName: Integration devel
+ dependsOn: []
+ jobs:
+ - template: templates/matrix.yml
+ parameters:
+ groups: [1, 2, 3]
+ targets:
+ - name: (py3.12)
+ test: devel/integration/3.12
-## Integration tests (remote)
- - stage: Hetzner_devel
- displayName: Hetzner devel
+ - stage: Integration_2_16
+ displayName: Integration 2.16
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
- groups:
- - 1
- - 2
+ groups: [1, 2, 3]
targets:
- - name: hcloud
- test: 'devel/hcloud/3.9'
+ - name: (py3.10)
+ test: 2.16/integration/3.10
- - stage: Hetzner_2_14
- displayName: Hetzner 2.14
+ - stage: Integration_2_15
+ displayName: Integration 2.15
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
- groups:
- - 1
- - 2
+ groups: [1, 2, 3]
targets:
- - name: hcloud
- test: '2.14/hcloud/3.9'
+ - name: (py3.9)
+ test: 2.15/integration/3.9
- - stage: Hetzner_2_13
- displayName: Hetzner 2.13
+ - stage: Integration_2_14
+ displayName: Integration 2.14
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
- groups:
- - 1
- - 2
+ groups: [1, 2, 3]
targets:
- - name: hcloud
- test: '2.13/hcloud/3.9'
+ - name: (py3.9)
+ test: 2.14/integration/3.9
- - stage: Hetzner_2_12
- displayName: Hetzner 2.12
+ - stage: Integration_2_13
+ displayName: Integration 2.13
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
- groups:
- - 1
- - 2
+ groups: [1, 2, 3]
targets:
- - name: hcloud
- test: '2.12/hcloud/3.9'
+ - name: (py3.8)
+ test: 2.13/integration/3.8
-### Finally
+ ### Finally
- stage: Summary
condition: succeededOrFailed()
dependsOn:
- - Ansible_devel
- - Ansible_2_14
- - Ansible_2_13
- - Ansible_2_12
- - Hetzner_devel
- - Hetzner_2_14
- - Hetzner_2_13
- - Hetzner_2_12
+ - Sanity_devel
+ - Sanity_2_16
+ - Sanity_2_15
+ - Sanity_2_14
+ - Sanity_2_13
+ - Units_devel
+ - Units_2_16
+ - Units_2_15
+ - Units_2_14
+ - Units_2_13
+ - Integration_devel
+ - Integration_2_16
+ - Integration_2_15
+ - Integration_2_14
+ - Integration_2_13
jobs:
- template: templates/coverage.yml
diff --git a/ansible_collections/hetzner/hcloud/.azure-pipelines/scripts/aggregate-coverage.sh b/ansible_collections/hetzner/hcloud/.azure-pipelines/scripts/aggregate-coverage.sh
index f3113dd0a..c196ab014 100755
--- a/ansible_collections/hetzner/hcloud/.azure-pipelines/scripts/aggregate-coverage.sh
+++ b/ansible_collections/hetzner/hcloud/.azure-pipelines/scripts/aggregate-coverage.sh
@@ -13,8 +13,8 @@ options=(--venv --venv-system-site-packages --color -v)
ansible-test coverage combine --export "${agent_temp_directory}/coverage/" "${options[@]}"
-if ansible-test coverage analyze targets generate --help >/dev/null 2>&1; then
- # Only analyze coverage if the installed version of ansible-test supports it.
- # Doing so allows this script to work unmodified for multiple Ansible versions.
- ansible-test coverage analyze targets generate "${agent_temp_directory}/coverage/coverage-analyze-targets.json" "${options[@]}"
+if ansible-test coverage analyze targets generate --help > /dev/null 2>&1; then
+ # Only analyze coverage if the installed version of ansible-test supports it.
+ # Doing so allows this script to work unmodified for multiple Ansible versions.
+ ansible-test coverage analyze targets generate "${agent_temp_directory}/coverage/coverage-analyze-targets.json" "${options[@]}"
fi
diff --git a/ansible_collections/hetzner/hcloud/.azure-pipelines/scripts/combine-coverage.py b/ansible_collections/hetzner/hcloud/.azure-pipelines/scripts/combine-coverage.py
index 506ade646..bab3c4226 100755
--- a/ansible_collections/hetzner/hcloud/.azure-pipelines/scripts/combine-coverage.py
+++ b/ansible_collections/hetzner/hcloud/.azure-pipelines/scripts/combine-coverage.py
@@ -7,8 +7,7 @@ Keep in mind that Azure Pipelines does not enforce unique job display names (onl
It is up to pipeline authors to avoid name collisions when deviating from the recommended format.
"""
-from __future__ import (absolute_import, division, print_function)
-__metaclass__ = type
+from __future__ import annotations
import os
import re
@@ -20,12 +19,12 @@ def main():
"""Main program entry point."""
source_directory = sys.argv[1]
- if '/ansible_collections/' in os.getcwd():
+ if "/ansible_collections/" in os.getcwd():
output_path = "tests/output"
else:
output_path = "test/results"
- destination_directory = os.path.join(output_path, 'coverage')
+ destination_directory = os.path.join(output_path, "coverage")
if not os.path.exists(destination_directory):
os.makedirs(destination_directory)
@@ -34,27 +33,27 @@ def main():
count = 0
for name in os.listdir(source_directory):
- match = re.search('^Coverage (?P<attempt>[0-9]+) (?P<label>.+)$', name)
- label = match.group('label')
- attempt = int(match.group('attempt'))
+ match = re.search("^Coverage (?P<attempt>[0-9]+) (?P<label>.+)$", name)
+ label = match.group("label")
+ attempt = int(match.group("attempt"))
jobs[label] = max(attempt, jobs.get(label, 0))
for label, attempt in jobs.items():
- name = 'Coverage {attempt} {label}'.format(label=label, attempt=attempt)
+ name = f"Coverage {attempt} {label}"
source = os.path.join(source_directory, name)
source_files = os.listdir(source)
for source_file in source_files:
source_path = os.path.join(source, source_file)
- destination_path = os.path.join(destination_directory, source_file + '.' + label)
- print('"%s" -> "%s"' % (source_path, destination_path))
+ destination_path = os.path.join(destination_directory, source_file + "." + label)
+ print(f'"{source_path}" -> "{destination_path}"')
shutil.copyfile(source_path, destination_path)
count += 1
- print('Coverage file count: %d' % count)
- print('##vso[task.setVariable variable=coverageFileCount]%d' % count)
- print('##vso[task.setVariable variable=outputPath]%s' % output_path)
+ print("Coverage file count: %d" % count)
+ print("##vso[task.setVariable variable=coverageFileCount]%d" % count)
+ print("##vso[task.setVariable variable=outputPath]%s" % output_path)
-if __name__ == '__main__':
+if __name__ == "__main__":
main()
diff --git a/ansible_collections/hetzner/hcloud/.azure-pipelines/scripts/publish-codecov.sh b/ansible_collections/hetzner/hcloud/.azure-pipelines/scripts/publish-codecov.sh
index 6d184f0b8..5dd7cfde7 100755
--- a/ansible_collections/hetzner/hcloud/.azure-pipelines/scripts/publish-codecov.sh
+++ b/ansible_collections/hetzner/hcloud/.azure-pipelines/scripts/publish-codecov.sh
@@ -10,18 +10,18 @@ output_path="$1"
curl --silent --show-error https://ansible-ci-files.s3.us-east-1.amazonaws.com/codecov/codecov.sh > codecov.sh
for file in "${output_path}"/reports/coverage*.xml; do
- name="${file}"
- name="${name##*/}" # remove path
- name="${name##coverage=}" # remove 'coverage=' prefix if present
- name="${name%.xml}" # remove '.xml' suffix
+ name="${file}"
+ name="${name##*/}" # remove path
+ name="${name##coverage=}" # remove 'coverage=' prefix if present
+ name="${name%.xml}" # remove '.xml' suffix
- bash codecov.sh \
- -f "${file}" \
- -n "${name}" \
- -X coveragepy \
- -X gcov \
- -X fix \
- -X search \
- -X xcode \
- || echo "Failed to upload code coverage report to codecov.io: ${file}"
+ bash codecov.sh \
+ -f "${file}" \
+ -n "${name}" \
+ -X coveragepy \
+ -X gcov \
+ -X fix \
+ -X search \
+ -X xcode ||
+ echo "Failed to upload code coverage report to codecov.io: ${file}"
done
diff --git a/ansible_collections/hetzner/hcloud/.azure-pipelines/scripts/report-coverage.sh b/ansible_collections/hetzner/hcloud/.azure-pipelines/scripts/report-coverage.sh
index 1bd91bdc9..a397f63e7 100755
--- a/ansible_collections/hetzner/hcloud/.azure-pipelines/scripts/report-coverage.sh
+++ b/ansible_collections/hetzner/hcloud/.azure-pipelines/scripts/report-coverage.sh
@@ -5,11 +5,11 @@ set -o pipefail -eu
PATH="${PWD}/bin:${PATH}"
-if ! ansible-test --help >/dev/null 2>&1; then
- # Install the devel version of ansible-test for generating code coverage reports.
- # This is only used by Ansible Collections, which are typically tested against multiple Ansible versions (in separate jobs).
- # Since a version of ansible-test is required that can work the output from multiple older releases, the devel version is used.
- pip install https://github.com/ansible/ansible/archive/devel.tar.gz --disable-pip-version-check
+if ! ansible-test --help > /dev/null 2>&1; then
+ # Install the devel version of ansible-test for generating code coverage reports.
+ # This is only used by Ansible Collections, which are typically tested against multiple Ansible versions (in separate jobs).
+ # Since a version of ansible-test is required that can work the output from multiple older releases, the devel version is used.
+ pip install https://github.com/ansible/ansible/archive/devel.tar.gz --disable-pip-version-check
fi
ansible-test coverage xml --stub --venv --venv-system-site-packages --color -v
diff --git a/ansible_collections/hetzner/hcloud/.azure-pipelines/scripts/run-tests.sh b/ansible_collections/hetzner/hcloud/.azure-pipelines/scripts/run-tests.sh
index a947fdf01..25a576cba 100755
--- a/ansible_collections/hetzner/hcloud/.azure-pipelines/scripts/run-tests.sh
+++ b/ansible_collections/hetzner/hcloud/.azure-pipelines/scripts/run-tests.sh
@@ -4,7 +4,7 @@
set -o pipefail -eu
entry_point="$1"
-test="$2"
+entry_point_args="$2"
read -r -a coverage_branches <<< "$3" # space separated list of branches to run code coverage on for scheduled builds
export COMMIT_MESSAGE
@@ -13,22 +13,22 @@ export COVERAGE
export IS_PULL_REQUEST
if [ "${SYSTEM_PULLREQUEST_TARGETBRANCH:-}" ]; then
- IS_PULL_REQUEST=true
- COMMIT_MESSAGE=$(git log --format=%B -n 1 HEAD^2)
+ IS_PULL_REQUEST=true
+ COMMIT_MESSAGE=$(git log --format=%B -n 1 HEAD^2)
else
- IS_PULL_REQUEST=
- COMMIT_MESSAGE=$(git log --format=%B -n 1 HEAD)
+ IS_PULL_REQUEST=false
+ COMMIT_MESSAGE=$(git log --format=%B -n 1 HEAD)
fi
-COMPLETE=
-COVERAGE=
+COMPLETE=false
+COVERAGE=false
if [ "${BUILD_REASON}" = "Schedule" ]; then
- COMPLETE=yes
+ COMPLETE=true
- if printf '%s\n' "${coverage_branches[@]}" | grep -q "^${BUILD_SOURCEBRANCHNAME}$"; then
- COVERAGE=yes
- fi
+ if printf '%s\n' "${coverage_branches[@]}" | grep -q "^${BUILD_SOURCEBRANCHNAME}$"; then
+ COVERAGE=true
+ fi
fi
-"${entry_point}" "${test}" 2>&1 | "$(dirname "$0")/time-command.py"
+"${entry_point}" "${entry_point_args}" 2>&1 | "$(dirname "$0")/time-command.py"
diff --git a/ansible_collections/hetzner/hcloud/.azure-pipelines/scripts/time-command.py b/ansible_collections/hetzner/hcloud/.azure-pipelines/scripts/time-command.py
index 5e8eb8d4c..783e745d8 100755
--- a/ansible_collections/hetzner/hcloud/.azure-pipelines/scripts/time-command.py
+++ b/ansible_collections/hetzner/hcloud/.azure-pipelines/scripts/time-command.py
@@ -1,8 +1,7 @@
#!/usr/bin/env python
"""Prepends a relative timestamp to each input line from stdin and writes it to stdout."""
-from __future__ import (absolute_import, division, print_function)
-__metaclass__ = type
+from __future__ import annotations
import sys
import time
@@ -12,14 +11,14 @@ def main():
"""Main program entry point."""
start = time.time()
- sys.stdin.reconfigure(errors='surrogateescape')
- sys.stdout.reconfigure(errors='surrogateescape')
+ sys.stdin.reconfigure(errors="surrogateescape")
+ sys.stdout.reconfigure(errors="surrogateescape")
for line in sys.stdin:
seconds = time.time() - start
- sys.stdout.write('%02d:%02d %s' % (seconds // 60, seconds % 60, line))
+ sys.stdout.write("%02d:%02d %s" % (seconds // 60, seconds % 60, line))
sys.stdout.flush()
-if __name__ == '__main__':
+if __name__ == "__main__":
main()
diff --git a/ansible_collections/hetzner/hcloud/.azure-pipelines/templates/matrix.yml b/ansible_collections/hetzner/hcloud/.azure-pipelines/templates/matrix.yml
index 4e9555dd3..d0a659f71 100644
--- a/ansible_collections/hetzner/hcloud/.azure-pipelines/templates/matrix.yml
+++ b/ansible_collections/hetzner/hcloud/.azure-pipelines/templates/matrix.yml
@@ -45,11 +45,11 @@ jobs:
parameters:
jobs:
- ${{ if eq(length(parameters.groups), 0) }}:
- - ${{ each target in parameters.targets }}:
- - name: ${{ format(parameters.nameFormat, coalesce(target.name, target.test)) }}
- test: ${{ format(parameters.testFormat, coalesce(target.test, target.name)) }}
- - ${{ if not(eq(length(parameters.groups), 0)) }}:
- - ${{ each group in parameters.groups }}:
- ${{ each target in parameters.targets }}:
- - name: ${{ format(format(parameters.nameGroupFormat, parameters.nameFormat), coalesce(target.name, target.test), group) }}
- test: ${{ format(format(parameters.testGroupFormat, parameters.testFormat), coalesce(target.test, target.name), group) }}
+ - name: ${{ format(parameters.nameFormat, coalesce(target.name, target.test)) }}
+ test: ${{ format(parameters.testFormat, coalesce(target.test, target.name)) }}
+ - ${{ if not(eq(length(parameters.groups), 0)) }}:
+ - ${{ each group in parameters.groups }}:
+ - ${{ each target in parameters.targets }}:
+ - name: ${{ format(format(parameters.nameGroupFormat, parameters.nameFormat), coalesce(target.name, target.test), group) }}
+ test: ${{ format(format(parameters.testGroupFormat, parameters.testFormat), coalesce(target.test, target.name), group) }}
diff --git a/ansible_collections/hetzner/hcloud/.azure-pipelines/templates/test.yml b/ansible_collections/hetzner/hcloud/.azure-pipelines/templates/test.yml
index 5250ed802..a4ea5a78d 100644
--- a/ansible_collections/hetzner/hcloud/.azure-pipelines/templates/test.yml
+++ b/ansible_collections/hetzner/hcloud/.azure-pipelines/templates/test.yml
@@ -9,37 +9,37 @@ parameters:
jobs:
- ${{ each job in parameters.jobs }}:
- - job: test_${{ replace(replace(replace(job.test, '/', '_'), '.', '_'), '-', '_') }}
- displayName: ${{ job.name }}
- container: default
- workspace:
- clean: all
- steps:
- - checkout: self
- fetchDepth: $(fetchDepth)
- path: $(checkoutPath)
- - bash: .azure-pipelines/scripts/run-tests.sh "$(entryPoint)" "${{ job.test }}" "$(coverageBranches)"
- displayName: Run Tests
- - bash: .azure-pipelines/scripts/process-results.sh
- condition: succeededOrFailed()
- displayName: Process Results
- - bash: .azure-pipelines/scripts/aggregate-coverage.sh "$(Agent.TempDirectory)"
- condition: eq(variables.haveCoverageData, 'true')
- displayName: Aggregate Coverage Data
- - task: PublishTestResults@2
- condition: eq(variables.haveTestResults, 'true')
- inputs:
- testResultsFiles: "$(outputPath)/junit/*.xml"
- displayName: Publish Test Results
- - task: PublishPipelineArtifact@1
- condition: eq(variables.haveBotResults, 'true')
- displayName: Publish Bot Results
- inputs:
- targetPath: "$(outputPath)/bot/"
- artifactName: "Bot $(System.JobAttempt) $(System.StageDisplayName) $(System.JobDisplayName)"
- - task: PublishPipelineArtifact@1
- condition: eq(variables.haveCoverageData, 'true')
- displayName: Publish Coverage Data
- inputs:
- targetPath: "$(Agent.TempDirectory)/coverage/"
- artifactName: "Coverage $(System.JobAttempt) $(System.StageDisplayName) $(System.JobDisplayName)"
+ - job: test_${{ replace(replace(replace(job.test, '/', '_'), '.', '_'), '-', '_') }}
+ displayName: ${{ job.name }}
+ container: default
+ workspace:
+ clean: all
+ steps:
+ - checkout: self
+ fetchDepth: $(fetchDepth)
+ path: $(checkoutPath)
+ - bash: .azure-pipelines/scripts/run-tests.sh "$(entryPoint)" "${{ job.test }}" "$(coverageBranches)"
+ displayName: Run Tests
+ - bash: .azure-pipelines/scripts/process-results.sh
+ condition: succeededOrFailed()
+ displayName: Process Results
+ - bash: .azure-pipelines/scripts/aggregate-coverage.sh "$(Agent.TempDirectory)"
+ condition: eq(variables.haveCoverageData, 'true')
+ displayName: Aggregate Coverage Data
+ - task: PublishTestResults@2
+ condition: eq(variables.haveTestResults, 'true')
+ inputs:
+ testResultsFiles: "$(outputPath)/junit/*.xml"
+ displayName: Publish Test Results
+ - task: PublishPipelineArtifact@1
+ condition: eq(variables.haveBotResults, 'true')
+ displayName: Publish Bot Results
+ inputs:
+ targetPath: "$(outputPath)/bot/"
+ artifactName: "Bot $(System.JobAttempt) $(System.StageDisplayName) $(System.JobDisplayName)"
+ - task: PublishPipelineArtifact@1
+ condition: eq(variables.haveCoverageData, 'true')
+ displayName: Publish Coverage Data
+ inputs:
+ targetPath: "$(Agent.TempDirectory)/coverage/"
+ artifactName: "Coverage $(System.JobAttempt) $(System.StageDisplayName) $(System.JobDisplayName)"