fix(vpn-node-config): resolve ansible-lint violations
OpenVPN Ansible / Deploy VPN Networking and OpenVPN (push) Canceled after 0s
OpenVPN Ansible / Generate SBOM (push) Canceled after 0s
OpenVPN Ansible / Scan SBOM with Trivy (push) Canceled after 0s
OpenVPN Ansible / Ansible Syntax Check (push) Canceled after 38s
OpenVPN Ansible / Ansible Lint (push) Canceled after 40s
OpenVPN Ansible / Deploy VPN Networking and OpenVPN (push) Canceled after 0s
OpenVPN Ansible / Generate SBOM (push) Canceled after 0s
OpenVPN Ansible / Scan SBOM with Trivy (push) Canceled after 0s
OpenVPN Ansible / Ansible Syntax Check (push) Canceled after 38s
OpenVPN Ansible / Ansible Lint (push) Canceled after 40s
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
<!--
|
||||
Copyright (c) Ansible Project
|
||||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
-->
|
||||
|
||||
## Azure Pipelines Configuration
|
||||
|
||||
Please see the [Documentation](https://github.com/ansible/community/wiki/Testing:-Azure-Pipelines) for more information.
|
||||
+438
@@ -0,0 +1,438 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
trigger:
|
||||
batch: true
|
||||
branches:
|
||||
include:
|
||||
- main
|
||||
- stable-*
|
||||
|
||||
pr:
|
||||
autoCancel: true
|
||||
branches:
|
||||
include:
|
||||
- main
|
||||
- stable-*
|
||||
|
||||
schedules:
|
||||
- cron: 0 8 * * *
|
||||
displayName: Nightly (main)
|
||||
always: true
|
||||
branches:
|
||||
include:
|
||||
- main
|
||||
- cron: 0 10 * * *
|
||||
displayName: Nightly (active stable branches)
|
||||
always: true
|
||||
branches:
|
||||
include:
|
||||
- stable-14
|
||||
- stable-13
|
||||
- cron: 0 11 * * 0
|
||||
displayName: Weekly (old stable branches)
|
||||
always: true
|
||||
branches:
|
||||
include:
|
||||
- stable-12
|
||||
|
||||
variables:
|
||||
- name: checkoutPath
|
||||
value: ansible_collections/community/general
|
||||
- name: coverageBranches
|
||||
value: main
|
||||
- name: entryPoint
|
||||
value: tests/utils/shippable/nox.sh
|
||||
- name: prepareEntryPoint
|
||||
value: tests/utils/shippable/nox-prepare.sh
|
||||
- name: fetchDepth
|
||||
value: 0
|
||||
|
||||
resources:
|
||||
containers:
|
||||
- container: default
|
||||
image: quay.io/ansible/azure-pipelines-test-container:8.0.0
|
||||
|
||||
pool: Standard
|
||||
|
||||
stages:
|
||||
- stage: sanity
|
||||
displayName: Sanity
|
||||
dependsOn: []
|
||||
variables:
|
||||
entryPoint: tests/utils/shippable/nox.sh
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
targets:
|
||||
- name: ansible-core 2.20
|
||||
test: ansible-test-sanity-2.20
|
||||
- name: ansible-core 2.21
|
||||
test: ansible-test-sanity-2.21
|
||||
- name: ansible-core 2.22
|
||||
test: ansible-test-sanity-2.22
|
||||
- name: ansible-core devel
|
||||
test: ansible-test-sanity-devel
|
||||
- name: Extra sanity tests
|
||||
test: extra-sanity-tests
|
||||
|
||||
- stage: units_2_20
|
||||
displayName: Units 2.20
|
||||
dependsOn: []
|
||||
variables:
|
||||
entryPoint: tests/utils/shippable/nox.sh
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
targets:
|
||||
- name: Python 3.9
|
||||
test: ansible-test-units-2.20-3.9
|
||||
- name: Python 3.12
|
||||
test: ansible-test-units-2.20-3.12
|
||||
- name: Python 3.14
|
||||
test: ansible-test-units-2.20-3.14
|
||||
|
||||
- stage: units_2_21
|
||||
displayName: Units 2.21
|
||||
dependsOn: []
|
||||
variables:
|
||||
entryPoint: tests/utils/shippable/nox.sh
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
targets:
|
||||
- name: Python 3.9
|
||||
test: ansible-test-units-2.21-3.9
|
||||
- name: Python 3.12
|
||||
test: ansible-test-units-2.21-3.12
|
||||
- name: Python 3.14
|
||||
test: ansible-test-units-2.21-3.14
|
||||
|
||||
- stage: units_2_22
|
||||
displayName: Units 2.22
|
||||
dependsOn: []
|
||||
variables:
|
||||
entryPoint: tests/utils/shippable/nox.sh
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
targets:
|
||||
- name: Python 3.10
|
||||
test: ansible-test-units-2.22-3.10
|
||||
- name: Python 3.13
|
||||
test: ansible-test-units-2.22-3.13
|
||||
- name: Python 3.15
|
||||
test: ansible-test-units-2.22-3.15
|
||||
|
||||
- stage: units_devel
|
||||
displayName: Units devel
|
||||
dependsOn: []
|
||||
variables:
|
||||
entryPoint: tests/utils/shippable/nox.sh
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
targets:
|
||||
- name: Python 3.10
|
||||
test: ansible-test-units-devel-3.10
|
||||
- name: Python 3.11
|
||||
test: ansible-test-units-devel-3.11
|
||||
- name: Python 3.12
|
||||
test: ansible-test-units-devel-3.12
|
||||
- name: Python 3.13
|
||||
test: ansible-test-units-devel-3.13
|
||||
- name: Python 3.14
|
||||
test: ansible-test-units-devel-3.14
|
||||
- name: Python 3.15
|
||||
test: ansible-test-units-devel-3.15
|
||||
|
||||
- stage: docker_2_20
|
||||
displayName: Docker 2.20
|
||||
dependsOn: []
|
||||
variables:
|
||||
entryPoint: tests/utils/shippable/nox.sh
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
targets:
|
||||
- name: Alpine 3.22 + group 1
|
||||
test: ansible-test-integration-2.20-alpine322-azp-posix-1
|
||||
- name: Alpine 3.22 + group 2
|
||||
test: ansible-test-integration-2.20-alpine322-azp-posix-2
|
||||
- name: Alpine 3.22 + group 3
|
||||
test: ansible-test-integration-2.20-alpine322-azp-posix-3
|
||||
- name: Generic + py3.10 + generic group 1
|
||||
test: ansible-test-integration-2.20-default-3.10-azp-generic-1
|
||||
- name: Generic + py3.14 + generic group 1
|
||||
test: ansible-test-integration-2.20-default-3.14-azp-generic-1
|
||||
- name: Fedora 42 + group 1
|
||||
test: ansible-test-integration-2.20-fedora42-azp-posix-1
|
||||
- name: Fedora 42 + group 2
|
||||
test: ansible-test-integration-2.20-fedora42-azp-posix-2
|
||||
- name: Fedora 42 + group 3
|
||||
test: ansible-test-integration-2.20-fedora42-azp-posix-3
|
||||
|
||||
- stage: docker_2_21
|
||||
displayName: Docker 2.21
|
||||
dependsOn: []
|
||||
variables:
|
||||
entryPoint: tests/utils/shippable/nox.sh
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
targets:
|
||||
- name: Alpine 3.23 + group 1
|
||||
test: ansible-test-integration-2.21-alpine323-azp-posix-1
|
||||
- name: Alpine 3.23 + group 2
|
||||
test: ansible-test-integration-2.21-alpine323-azp-posix-2
|
||||
- name: Alpine 3.23 + group 3
|
||||
test: ansible-test-integration-2.21-alpine323-azp-posix-3
|
||||
- name: Generic + py3.12 + generic group 1
|
||||
test: ansible-test-integration-2.21-default-3.12-azp-generic-1
|
||||
- name: Generic + py3.14 + generic group 1
|
||||
test: ansible-test-integration-2.21-default-3.14-azp-generic-1
|
||||
- name: Generic + py3.9 + generic group 1
|
||||
test: ansible-test-integration-2.21-default-3.9-azp-generic-1
|
||||
- name: Fedora 43 + group 1
|
||||
test: ansible-test-integration-2.21-fedora43-azp-posix-1
|
||||
- name: Fedora 43 + group 2
|
||||
test: ansible-test-integration-2.21-fedora43-azp-posix-2
|
||||
- name: Fedora 43 + group 3
|
||||
test: ansible-test-integration-2.21-fedora43-azp-posix-3
|
||||
- name: Ubuntu 22.04 + group 1
|
||||
test: ansible-test-integration-2.21-ubuntu2204-azp-posix-1
|
||||
- name: Ubuntu 22.04 + group 2
|
||||
test: ansible-test-integration-2.21-ubuntu2204-azp-posix-2
|
||||
- name: Ubuntu 22.04 + group 3
|
||||
test: ansible-test-integration-2.21-ubuntu2204-azp-posix-3
|
||||
- name: Ubuntu 24.04 + group 1
|
||||
test: ansible-test-integration-2.21-ubuntu2404-azp-posix-1
|
||||
- name: Ubuntu 24.04 + group 2
|
||||
test: ansible-test-integration-2.21-ubuntu2404-azp-posix-2
|
||||
- name: Ubuntu 24.04 + group 3
|
||||
test: ansible-test-integration-2.21-ubuntu2404-azp-posix-3
|
||||
|
||||
- stage: docker_2_22
|
||||
displayName: Docker 2.22
|
||||
dependsOn: []
|
||||
variables:
|
||||
entryPoint: tests/utils/shippable/nox.sh
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
targets:
|
||||
- name: Generic + py3.13 + generic group 1
|
||||
test: ansible-test-integration-2.22-default-3.13-azp-generic-1
|
||||
- name: Generic + py3.15 + generic group 1
|
||||
test: ansible-test-integration-2.22-default-3.15-azp-generic-1
|
||||
- name: Generic + py3.9 + generic group 1
|
||||
test: ansible-test-integration-2.22-default-3.9-azp-generic-1
|
||||
- name: Fedora 44 + group 1
|
||||
test: ansible-test-integration-2.22-fedora44-azp-posix-1
|
||||
- name: Fedora 44 + group 2
|
||||
test: ansible-test-integration-2.22-fedora44-azp-posix-2
|
||||
- name: Fedora 44 + group 3
|
||||
test: ansible-test-integration-2.22-fedora44-azp-posix-3
|
||||
- name: Ubuntu 26.04 + group 1
|
||||
test: ansible-test-integration-2.22-ubuntu2604-azp-posix-1
|
||||
- name: Ubuntu 26.04 + group 2
|
||||
test: ansible-test-integration-2.22-ubuntu2604-azp-posix-2
|
||||
- name: Ubuntu 26.04 + group 3
|
||||
test: ansible-test-integration-2.22-ubuntu2604-azp-posix-3
|
||||
|
||||
- stage: docker_devel
|
||||
displayName: Docker devel
|
||||
dependsOn: []
|
||||
variables:
|
||||
entryPoint: tests/utils/shippable/nox.sh
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
targets:
|
||||
- name: Alpine 3.24 + group 1
|
||||
test: ansible-test-integration-devel-alpine324-azp-posix-1
|
||||
- name: Alpine 3.24 + group 2
|
||||
test: ansible-test-integration-devel-alpine324-azp-posix-2
|
||||
- name: Alpine 3.24 + group 3
|
||||
test: ansible-test-integration-devel-alpine324-azp-posix-3
|
||||
- name: Arch Linux + py3.14 + group 1
|
||||
test: ansible-test-integration-devel-archlinux-3.14-azp-posix-1
|
||||
- name: Arch Linux + py3.14 + group 2
|
||||
test: ansible-test-integration-devel-archlinux-3.14-azp-posix-2
|
||||
- name: Arch Linux + py3.14 + group 3
|
||||
test: ansible-test-integration-devel-archlinux-3.14-azp-posix-3
|
||||
- name: Debian 13 + py3.13 + group 1
|
||||
test: ansible-test-integration-devel-debian-13-trixie-3.13-azp-posix-1
|
||||
- name: Debian 13 + py3.13 + group 2
|
||||
test: ansible-test-integration-devel-debian-13-trixie-3.13-azp-posix-2
|
||||
- name: Debian 13 + py3.13 + group 3
|
||||
test: ansible-test-integration-devel-debian-13-trixie-3.13-azp-posix-3
|
||||
- name: Debian 12 + py3.11 + group 1
|
||||
test: ansible-test-integration-devel-debian-bookworm-3.11-azp-posix-1
|
||||
- name: Debian 12 + py3.11 + group 2
|
||||
test: ansible-test-integration-devel-debian-bookworm-3.11-azp-posix-2
|
||||
- name: Debian 12 + py3.11 + group 3
|
||||
test: ansible-test-integration-devel-debian-bookworm-3.11-azp-posix-3
|
||||
- name: Generic + py3.10 + generic group 1
|
||||
test: ansible-test-integration-devel-default-3.10-azp-generic-1
|
||||
- name: Generic + py3.13 + generic group 1
|
||||
test: ansible-test-integration-devel-default-3.13-azp-generic-1
|
||||
- name: Generic + py3.15 + generic group 1
|
||||
test: ansible-test-integration-devel-default-3.15-azp-generic-1
|
||||
- name: Fedora 44 + group 1
|
||||
test: ansible-test-integration-devel-fedora44-azp-posix-1
|
||||
- name: Fedora 44 + group 2
|
||||
test: ansible-test-integration-devel-fedora44-azp-posix-2
|
||||
- name: Fedora 44 + group 3
|
||||
test: ansible-test-integration-devel-fedora44-azp-posix-3
|
||||
- name: OpenSuSE Leap 16.0 + py3.13 + group 1
|
||||
test: ansible-test-integration-devel-opensuse-leap-16.0-3.13-azp-posix-1
|
||||
- name: OpenSuSE Leap 16.0 + py3.13 + group 2
|
||||
test: ansible-test-integration-devel-opensuse-leap-16.0-3.13-azp-posix-2
|
||||
- name: OpenSuSE Leap 16.0 + py3.13 + group 3
|
||||
test: ansible-test-integration-devel-opensuse-leap-16.0-3.13-azp-posix-3
|
||||
- name: OpenSuSE Tumbleweed + py3.13 + group 1
|
||||
test: ansible-test-integration-devel-opensuse-tumbleweed-3.13-azp-posix-1
|
||||
- name: OpenSuSE Tumbleweed + py3.13 + group 2
|
||||
test: ansible-test-integration-devel-opensuse-tumbleweed-3.13-azp-posix-2
|
||||
- name: OpenSuSE Tumbleweed + py3.13 + group 3
|
||||
test: ansible-test-integration-devel-opensuse-tumbleweed-3.13-azp-posix-3
|
||||
- name: Ubuntu 24.04 + group 1
|
||||
test: ansible-test-integration-devel-ubuntu2404-azp-posix-1
|
||||
- name: Ubuntu 24.04 + group 2
|
||||
test: ansible-test-integration-devel-ubuntu2404-azp-posix-2
|
||||
- name: Ubuntu 24.04 + group 3
|
||||
test: ansible-test-integration-devel-ubuntu2404-azp-posix-3
|
||||
- name: Ubuntu 26.04 + group 1
|
||||
test: ansible-test-integration-devel-ubuntu2604-azp-posix-1
|
||||
- name: Ubuntu 26.04 + group 2
|
||||
test: ansible-test-integration-devel-ubuntu2604-azp-posix-2
|
||||
- name: Ubuntu 26.04 + group 3
|
||||
test: ansible-test-integration-devel-ubuntu2604-azp-posix-3
|
||||
|
||||
- stage: remote_2_20
|
||||
displayName: Remote 2.20
|
||||
dependsOn: []
|
||||
variables:
|
||||
entryPoint: tests/utils/shippable/nox.sh
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
targets:
|
||||
- name: macOS 15.3 + group 1
|
||||
test: ansible-test-integration-2.20-macos-15.3-azp-posix-1
|
||||
- name: macOS 15.3 + group 2
|
||||
test: ansible-test-integration-2.20-macos-15.3-azp-posix-2
|
||||
- name: macOS 15.3 + group 3
|
||||
test: ansible-test-integration-2.20-macos-15.3-azp-posix-3
|
||||
- name: RHEL 10.2 + group 1
|
||||
test: ansible-test-integration-2.20-rhel-10.2-azp-posix-1
|
||||
- name: RHEL 10.2 + group 2
|
||||
test: ansible-test-integration-2.20-rhel-10.2-azp-posix-2
|
||||
- name: RHEL 10.2 + group 3
|
||||
test: ansible-test-integration-2.20-rhel-10.2-azp-posix-3
|
||||
|
||||
- stage: remote_2_21
|
||||
displayName: Remote 2.21
|
||||
dependsOn: []
|
||||
variables:
|
||||
entryPoint: tests/utils/shippable/nox.sh
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
targets:
|
||||
- name: RHEL 9.8 + group 1
|
||||
test: ansible-test-integration-2.21-rhel-9.8-azp-posix-1
|
||||
- name: RHEL 9.8 + group 2
|
||||
test: ansible-test-integration-2.21-rhel-9.8-azp-posix-2
|
||||
- name: RHEL 9.8 + group 3
|
||||
test: ansible-test-integration-2.21-rhel-9.8-azp-posix-3
|
||||
|
||||
- stage: remote_2_22
|
||||
displayName: Remote 2.22
|
||||
dependsOn: []
|
||||
variables:
|
||||
entryPoint: tests/utils/shippable/nox.sh
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
targets:
|
||||
- name: macOS 26.3 + group 1
|
||||
test: ansible-test-integration-2.22-macos-26.3-azp-posix-1
|
||||
- name: macOS 26.3 + group 2
|
||||
test: ansible-test-integration-2.22-macos-26.3-azp-posix-2
|
||||
- name: macOS 26.3 + group 3
|
||||
test: ansible-test-integration-2.22-macos-26.3-azp-posix-3
|
||||
- name: RHEL 10.2 + group 1
|
||||
test: ansible-test-integration-2.22-rhel-10.2-azp-posix-1
|
||||
- name: RHEL 10.2 + group 2
|
||||
test: ansible-test-integration-2.22-rhel-10.2-azp-posix-2
|
||||
- name: RHEL 10.2 + group 3
|
||||
test: ansible-test-integration-2.22-rhel-10.2-azp-posix-3
|
||||
|
||||
- stage: remote_devel
|
||||
displayName: Remote devel
|
||||
dependsOn: []
|
||||
variables:
|
||||
entryPoint: tests/utils/shippable/nox.sh
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
targets:
|
||||
- name: Alpine 3.24 + extra VMs
|
||||
test: ansible-test-integration-devel-alpine-3.24-azp-posix-vm
|
||||
- name: FreeBSD 14.5 + group 1
|
||||
test: ansible-test-integration-devel-freebsd-14.5-azp-posix-1
|
||||
- name: FreeBSD 14.5 + group 2
|
||||
test: ansible-test-integration-devel-freebsd-14.5-azp-posix-2
|
||||
- name: FreeBSD 14.5 + group 3
|
||||
test: ansible-test-integration-devel-freebsd-14.5-azp-posix-3
|
||||
- name: FreeBSD 15.1 + group 1
|
||||
test: ansible-test-integration-devel-freebsd-15.1-azp-posix-1
|
||||
- name: FreeBSD 15.1 + group 2
|
||||
test: ansible-test-integration-devel-freebsd-15.1-azp-posix-2
|
||||
- name: FreeBSD 15.1 + group 3
|
||||
test: ansible-test-integration-devel-freebsd-15.1-azp-posix-3
|
||||
- name: macOS 26.3 + group 1
|
||||
test: ansible-test-integration-devel-macos-26.3-azp-posix-1
|
||||
- name: macOS 26.3 + group 2
|
||||
test: ansible-test-integration-devel-macos-26.3-azp-posix-2
|
||||
- name: macOS 26.3 + group 3
|
||||
test: ansible-test-integration-devel-macos-26.3-azp-posix-3
|
||||
- name: RHEL 10.2 + group 1
|
||||
test: ansible-test-integration-devel-rhel-10.2-azp-posix-1
|
||||
- name: RHEL 10.2 + group 2
|
||||
test: ansible-test-integration-devel-rhel-10.2-azp-posix-2
|
||||
- name: RHEL 10.2 + group 3
|
||||
test: ansible-test-integration-devel-rhel-10.2-azp-posix-3
|
||||
- name: RHEL 9.8 + group 1
|
||||
test: ansible-test-integration-devel-rhel-9.8-azp-posix-1
|
||||
- name: RHEL 9.8 + group 2
|
||||
test: ansible-test-integration-devel-rhel-9.8-azp-posix-2
|
||||
- name: RHEL 9.8 + group 3
|
||||
test: ansible-test-integration-devel-rhel-9.8-azp-posix-3
|
||||
- name: Ubuntu 24.04 + extra VMs
|
||||
test: ansible-test-integration-devel-ubuntu-24.04-azp-posix-vm
|
||||
- name: Ubuntu 26.04 + extra VMs
|
||||
test: ansible-test-integration-devel-ubuntu-26.04-azp-posix-vm
|
||||
|
||||
- stage: Summary
|
||||
condition: succeededOrFailed()
|
||||
dependsOn:
|
||||
- sanity
|
||||
- units_2_20
|
||||
- units_2_21
|
||||
- units_2_22
|
||||
- units_devel
|
||||
- docker_2_20
|
||||
- docker_2_21
|
||||
- docker_2_22
|
||||
- docker_devel
|
||||
- remote_2_20
|
||||
- remote_2_21
|
||||
- remote_2_22
|
||||
- remote_devel
|
||||
jobs:
|
||||
- template: templates/coverage.yml
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# Aggregate code coverage results for later processing.
|
||||
|
||||
set -o pipefail -eu
|
||||
|
||||
agent_temp_directory="$1"
|
||||
|
||||
PATH="${PWD}/bin:${PATH}"
|
||||
|
||||
mkdir "${agent_temp_directory}/coverage/"
|
||||
|
||||
options=(--venv --venv-system-site-packages --color -v)
|
||||
|
||||
ansible-test coverage combine --group-by command --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[@]}"
|
||||
fi
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
"""
|
||||
Combine coverage data from multiple jobs, keeping the data only from the most recent attempt from each job.
|
||||
Coverage artifacts must be named using the format: "Coverage $(System.JobAttempt) {StableUniqueNameForEachJob}"
|
||||
The recommended coverage artifact name format is: Coverage $(System.JobAttempt) $(System.StageDisplayName) $(System.JobDisplayName)
|
||||
Keep in mind that Azure Pipelines does not enforce unique job display names (only names).
|
||||
It is up to pipeline authors to avoid name collisions when deviating from the recommended format.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
"""Main program entry point."""
|
||||
source_directory = sys.argv[1]
|
||||
|
||||
if "/ansible_collections/" in os.getcwd():
|
||||
output_path = "tests/output"
|
||||
else:
|
||||
output_path = "test/results"
|
||||
|
||||
destination_directory = os.path.join(output_path, "coverage")
|
||||
|
||||
if not os.path.exists(destination_directory):
|
||||
os.makedirs(destination_directory)
|
||||
|
||||
jobs = {}
|
||||
count = 0
|
||||
|
||||
coverage_re = re.compile("^Coverage (?P<attempt>[0-9]+) (?P<label>.+)$")
|
||||
for name in os.listdir(source_directory):
|
||||
match = coverage_re.search(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 = 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(f'"{source_path}" -> "{destination_path}"')
|
||||
shutil.copyfile(source_path, destination_path)
|
||||
count += 1
|
||||
|
||||
print(f"Coverage file count: {count}")
|
||||
print(f"##vso[task.setVariable variable=coverageFileCount]{count}")
|
||||
print(f"##vso[task.setVariable variable=outputPath]{output_path}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# Check the test results and set variables for use in later steps.
|
||||
|
||||
set -o pipefail -eu
|
||||
|
||||
if [[ "$PWD" =~ /ansible_collections/ ]]; then
|
||||
output_path="tests/output"
|
||||
else
|
||||
output_path="test/results"
|
||||
fi
|
||||
|
||||
echo "##vso[task.setVariable variable=outputPath]${output_path}"
|
||||
|
||||
if compgen -G "${output_path}"'/junit/*.xml' > /dev/null; then
|
||||
echo "##vso[task.setVariable variable=haveTestResults]true"
|
||||
fi
|
||||
|
||||
if compgen -G "${output_path}"'/bot/ansible-test-*.json' > /dev/null; then
|
||||
echo "##vso[task.setVariable variable=haveBotResults]true"
|
||||
fi
|
||||
|
||||
if compgen -G "${output_path}"'/coverage/*' > /dev/null; then
|
||||
echo "##vso[task.setVariable variable=haveCoverageData]true"
|
||||
fi
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
"""
|
||||
Upload code coverage reports to codecov.io.
|
||||
Multiple coverage files from multiple languages are accepted and aggregated after upload.
|
||||
Python coverage, as well as PowerShell and Python stubs can all be uploaded.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import dataclasses
|
||||
import pathlib
|
||||
import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
import urllib.request
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class CoverageFile:
|
||||
name: str
|
||||
path: pathlib.Path
|
||||
flags: list[str]
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class Args:
|
||||
dry_run: bool
|
||||
path: pathlib.Path
|
||||
|
||||
|
||||
def parse_args() -> Args:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-n", "--dry-run", action="store_true")
|
||||
parser.add_argument("path", type=pathlib.Path)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
# Store arguments in a typed dataclass
|
||||
fields = dataclasses.fields(Args)
|
||||
kwargs = {field.name: getattr(args, field.name) for field in fields}
|
||||
|
||||
return Args(**kwargs)
|
||||
|
||||
|
||||
def process_files(directory: pathlib.Path) -> tuple[CoverageFile, ...]:
|
||||
processed = []
|
||||
for file in directory.joinpath("reports").glob("coverage*.xml"):
|
||||
name = file.stem.replace("coverage=", "")
|
||||
|
||||
# Get flags from name
|
||||
flags = name.replace("-powershell", "").split("=") # Drop '-powershell' suffix
|
||||
flags = [
|
||||
flag if not flag.startswith("stub") else flag.split("-")[0] for flag in flags
|
||||
] # Remove "-01" from stub files
|
||||
|
||||
processed.append(CoverageFile(name, file, flags))
|
||||
|
||||
return tuple(processed)
|
||||
|
||||
|
||||
def upload_files(codecov_bin: pathlib.Path, files: tuple[CoverageFile, ...], dry_run: bool = False) -> None:
|
||||
for file in files:
|
||||
cmd = [
|
||||
str(codecov_bin),
|
||||
"--name",
|
||||
file.name,
|
||||
"--file",
|
||||
str(file.path),
|
||||
]
|
||||
for flag in file.flags:
|
||||
cmd.extend(["--flags", flag])
|
||||
|
||||
if dry_run:
|
||||
print(f"DRY-RUN: Would run command: {cmd}")
|
||||
continue
|
||||
|
||||
subprocess.run(cmd, check=True)
|
||||
|
||||
|
||||
def download_file(url: str, dest: pathlib.Path, flags: int, dry_run: bool = False) -> None:
|
||||
if dry_run:
|
||||
print(f"DRY-RUN: Would download {url} to {dest} and set mode to {flags:o}")
|
||||
return
|
||||
|
||||
with urllib.request.urlopen(url) as resp:
|
||||
with dest.open("w+b") as f:
|
||||
# Read data in chunks rather than all at once
|
||||
shutil.copyfileobj(resp, f, 64 * 1024)
|
||||
|
||||
dest.chmod(flags)
|
||||
|
||||
|
||||
def main():
|
||||
args = parse_args()
|
||||
url = "https://ansible-ci-files.s3.amazonaws.com/codecov/linux/codecov"
|
||||
with tempfile.TemporaryDirectory(prefix="codecov-") as tmpdir:
|
||||
codecov_bin = pathlib.Path(tmpdir) / "codecov"
|
||||
download_file(url, codecov_bin, 0o755, args.dry_run)
|
||||
|
||||
files = process_files(args.path)
|
||||
upload_files(codecov_bin, files, args.dry_run)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# Generate code coverage reports for uploading to Azure Pipelines and codecov.io.
|
||||
|
||||
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
|
||||
fi
|
||||
|
||||
ansible-test coverage xml --group-by command --stub --venv --venv-system-site-packages --color -v
|
||||
Executable
+40
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# Configure the test environment and run the tests.
|
||||
|
||||
set -o pipefail -eu
|
||||
|
||||
entry_point="$1"
|
||||
test="$2"
|
||||
read -r -a coverage_branches <<< "$3" # space separated list of branches to run code coverage on for scheduled builds
|
||||
agent_temp_directory="$4"
|
||||
|
||||
export COMMIT_MESSAGE
|
||||
export COMPLETE
|
||||
export COVERAGE
|
||||
export IS_PULL_REQUEST
|
||||
export COVERAGE_DESTINATION_DIRECTORY="${agent_temp_directory}/coverage"
|
||||
|
||||
if [ "${SYSTEM_PULLREQUEST_TARGETBRANCH:-}" ]; then
|
||||
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)
|
||||
fi
|
||||
|
||||
COMPLETE=
|
||||
COVERAGE=
|
||||
|
||||
if [ "${BUILD_REASON}" = "Schedule" ]; then
|
||||
COMPLETE=yes
|
||||
|
||||
if printf '%s\n' "${coverage_branches[@]}" | grep -q "^${BUILD_SOURCEBRANCHNAME}$"; then
|
||||
COVERAGE=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
"${entry_point}" "${test}" 2>&1 | "$(dirname "$0")/time-command.py"
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
"""Prepends a relative timestamp to each input line from stdin and writes it to stdout."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
import time
|
||||
|
||||
|
||||
def main():
|
||||
"""Main program entry point."""
|
||||
start = time.time()
|
||||
|
||||
sys.stdin.reconfigure(errors="surrogateescape")
|
||||
sys.stdout.reconfigure(errors="surrogateescape")
|
||||
|
||||
for line in sys.stdin:
|
||||
seconds = int(time.time() - start)
|
||||
sys.stdout.write(f"{seconds // 60:02}:{seconds % 60:02} {line}")
|
||||
sys.stdout.flush()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# This template adds a job for processing code coverage data.
|
||||
# It will upload results to Azure Pipelines and codecov.io.
|
||||
# Use it from a job stage that completes after all other jobs have completed.
|
||||
# This can be done by placing it in a separate summary stage that runs after the test stage(s) have completed.
|
||||
|
||||
jobs:
|
||||
- job: Coverage
|
||||
displayName: Code Coverage
|
||||
container: default
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- checkout: self
|
||||
fetchDepth: $(fetchDepth)
|
||||
path: $(checkoutPath)
|
||||
- task: DownloadPipelineArtifact@2
|
||||
displayName: Download Coverage Data
|
||||
inputs:
|
||||
path: coverage/
|
||||
patterns: "Coverage */*=coverage.combined"
|
||||
- bash: .azure-pipelines/scripts/combine-coverage.py coverage/
|
||||
displayName: Combine Coverage Data
|
||||
- bash: .azure-pipelines/scripts/report-coverage.sh
|
||||
displayName: Generate Coverage Report
|
||||
condition: gt(variables.coverageFileCount, 0)
|
||||
- bash: .azure-pipelines/scripts/publish-codecov.py "$(outputPath)"
|
||||
displayName: Publish to codecov.io
|
||||
condition: gt(variables.coverageFileCount, 0)
|
||||
continueOnError: true
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# This template uses the provided targets and optional groups to generate a matrix which is then passed to the test template.
|
||||
# If this matrix template does not provide the required functionality, consider using the test template directly instead.
|
||||
|
||||
parameters:
|
||||
# A required list of dictionaries, one per test target.
|
||||
# Each item in the list must contain a "test" or "name" key.
|
||||
# Both may be provided. If one is omitted, the other will be used.
|
||||
- name: targets
|
||||
type: object
|
||||
|
||||
# An optional list of values which will be used to multiply the targets list into a matrix.
|
||||
# Values can be strings or numbers.
|
||||
- name: groups
|
||||
type: object
|
||||
default: []
|
||||
|
||||
# An optional format string used to generate the job name.
|
||||
# - {0} is the name of an item in the targets list.
|
||||
- name: nameFormat
|
||||
type: string
|
||||
default: "{0}"
|
||||
|
||||
# An optional format string used to generate the test name.
|
||||
# - {0} is the name of an item in the targets list.
|
||||
- name: testFormat
|
||||
type: string
|
||||
default: "{0}"
|
||||
|
||||
# An optional format string used to add the group to the job name.
|
||||
# {0} is the formatted name of an item in the targets list.
|
||||
# {{1}} is the group -- be sure to include the double "{{" and "}}".
|
||||
- name: nameGroupFormat
|
||||
type: string
|
||||
default: "{0} - {{1}}"
|
||||
|
||||
# An optional format string used to add the group to the test name.
|
||||
# {0} is the formatted test of an item in the targets list.
|
||||
# {{1}} is the group -- be sure to include the double "{{" and "}}".
|
||||
- name: testGroupFormat
|
||||
type: string
|
||||
default: "{0}/{{1}}"
|
||||
|
||||
jobs:
|
||||
- template: test.yml
|
||||
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) }}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# This template uses the provided list of jobs to create test one or more test jobs.
|
||||
# It can be used directly if needed, or through the matrix template.
|
||||
|
||||
parameters:
|
||||
# A required list of dictionaries, one per test job.
|
||||
# Each item in the list must contain a "job" and "name" key.
|
||||
- name: jobs
|
||||
type: object
|
||||
|
||||
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 "$(prepareEntryPoint)" "${{ job.test }}" "$(coverageBranches)" "$(Agent.TempDirectory)"
|
||||
displayName: Prepare Tests
|
||||
- bash: .azure-pipelines/scripts/run-tests.sh "$(entryPoint)" "${{ job.test }}" "$(coverageBranches)" "$(Agent.TempDirectory)"
|
||||
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)"
|
||||
Reference in New Issue
Block a user