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,38 @@
|
||||
<!--
|
||||
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
|
||||
-->
|
||||
|
||||
# Cleaning up `aliases` skips
|
||||
|
||||
The skip statements in `tests/integration/targets/*/aliases` files may contain specific OSes and their versions.
|
||||
|
||||
For example:
|
||||
|
||||
skip/rhel8.8
|
||||
skip/centos6
|
||||
skip/macos
|
||||
|
||||
Those items being skipped are called `remotes` and they come from the file `test/lib/ansible_test/_data/completion/remote.txt`
|
||||
in the `ansible-core` repository. Eventually, these remotes are removed from that `ansible_test` config,
|
||||
but they keep silently cluttering the aliases files here.
|
||||
|
||||
The scripts `list-remotes` and `clean-aliases-skips` can help you remove those entries from the `aliases` files.
|
||||
For that, you will need to have a clone of the `ansible-core` repository in your machine.
|
||||
|
||||
In the example below, the path to that repo is `../ansible`:
|
||||
|
||||
```shell
|
||||
./tests/utils/list-remotes ../ansible
|
||||
```
|
||||
|
||||
**Note:** The supported versions of `ansible-core` are hardcoded in `list-remotes`. Those should be updated or automated in the future.
|
||||
|
||||
To remove all the skips that are **not** in that list, you should run:
|
||||
|
||||
```shell
|
||||
./tests/utils/list-remotes ../ansible | ./tests/utils/clean-aliases-skips
|
||||
```
|
||||
|
||||
Make sure to thoroughly review the changes before committing!
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/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
|
||||
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def sanitize(filepath, remotes_re):
|
||||
with open(filepath) as fileread:
|
||||
lines = fileread.readlines()
|
||||
|
||||
changed = False
|
||||
out_lines = []
|
||||
for ll in lines:
|
||||
if not ll.startswith("skip/") or any(r.match(ll) for r in remotes_re):
|
||||
out_lines.append(ll)
|
||||
continue
|
||||
changed = True
|
||||
|
||||
if changed:
|
||||
print(f"sanitizing {filepath}", file=sys.stderr)
|
||||
with open(filepath, "w") as filewrite:
|
||||
filewrite.writelines(out_lines)
|
||||
|
||||
|
||||
def main():
|
||||
remotes = [x.strip() for x in sys.stdin.readlines()]
|
||||
remotes.append("docker")
|
||||
|
||||
print(f"Valid remotes: {', '.join(remotes)}", file=sys.stderr)
|
||||
|
||||
remotes_re = [re.compile(rf"^skip/{r}(\s.*)?$") for r in remotes]
|
||||
|
||||
for filepath in Path("tests/integration/targets").glob("*/aliases"):
|
||||
sanitize(filepath, remotes_re)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
# 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
|
||||
|
||||
pywinrm >= 0.3.0 # message encryption support
|
||||
pycrypto >= 2.6 # Need features found in 2.6 and greater
|
||||
ncclient >= 0.5.2 # Need features added in 0.5.2 and greater
|
||||
ntlm-auth >= 1.3.0 # message encryption support using cryptography
|
||||
requests-ntlm >= 1.1.0 # message encryption support
|
||||
requests-credssp >= 0.1.0 # message encryption support
|
||||
openshift >= 0.6.2, < 0.9.0 # merge_type support
|
||||
pyfmg == 0.6.1 # newer versions do not pass current unit tests
|
||||
pytest-mock >= 1.4.0 # needed for mock_use_standalone_module pytest option
|
||||
pyone < 7 # newer versions fail early
|
||||
cffi >= 1.14.2, != 1.14.3 # Yanked version which older versions of pip will still install:
|
||||
argcomplete < 3.7.1 ; python_version < '3.10' # 3.7.1 uses Python 3.10+ syntax
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
# 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
|
||||
|
||||
SUPPORTED_AC2="17 18 19 20"
|
||||
|
||||
[ -z "$1" ] && {
|
||||
echo 'usage: ./tests/utils/list-remotes <ansible git repo dir>' >&2
|
||||
exit 1
|
||||
}
|
||||
ansible_repo_dir="$1"
|
||||
|
||||
(
|
||||
cd "$ansible_repo_dir"
|
||||
|
||||
versions=$(
|
||||
for minor in $SUPPORTED_AC2; do
|
||||
echo v2.$minor.$(git tag -l | awk -F. "\$2 == $minor && /v2\.[0-9]+\.[0-9]+$/ { print \$3 }" | sort -rn | head -1)
|
||||
done
|
||||
)
|
||||
versions="$versions devel"
|
||||
|
||||
echo "Listing remotes from ansible-core:" $versions >&2
|
||||
for head in $versions; do
|
||||
git checkout -q $head
|
||||
cat test/lib/ansible_test/_data/completion/remote.txt
|
||||
done | awk '/[a-z]+(\/[0-9]+)?/ { print $1 }' | sort -u | sed -e s'/\///g'
|
||||
)
|
||||
Executable
+59
@@ -0,0 +1,59 @@
|
||||
#!/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
|
||||
|
||||
set -o pipefail -eux
|
||||
|
||||
# Fix for https://github.com/ansible-community/antsibull-nox/issues/222#issuecomment-4778928615
|
||||
# caused by https://github.com/ansible/azure-pipelines-test-container/blob/7714d81f64f268bbb10779e1265d312128607b76/Containerfile#L4
|
||||
export PATH="${PATH//:~\//:${HOME}/}"
|
||||
|
||||
nox_session="$1"
|
||||
|
||||
docker images ansible/ansible
|
||||
docker images quay.io/ansible/*
|
||||
docker ps
|
||||
|
||||
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
|
||||
|
||||
docker ps
|
||||
command -v python
|
||||
python -V
|
||||
|
||||
function retry
|
||||
{
|
||||
# shellcheck disable=SC2034
|
||||
for repetition in 1 2 3; do
|
||||
set +e
|
||||
"$@"
|
||||
result=$?
|
||||
set -e
|
||||
if [ ${result} == 0 ]; then
|
||||
return ${result}
|
||||
fi
|
||||
echo "@* -> ${result}"
|
||||
done
|
||||
echo "Command '@*' failed 3 times!"
|
||||
exit 255
|
||||
}
|
||||
|
||||
command -v pip
|
||||
pip --version
|
||||
pip list --disable-pip-version-check
|
||||
retry pip install https://github.com/ansible-community/antsibull-nox/archive/main.tar.gz --disable-pip-version-check
|
||||
|
||||
export PYTHONIOENCODING='utf-8'
|
||||
|
||||
export FORCE_COLOR=1
|
||||
export ANTSIBULL_NOX_IGNORE_INSTALLED_COLLECTIONS="true"
|
||||
|
||||
if [ "${nox_session}" == "extra-sanity-tests" ]; then
|
||||
# We need the ansible-galaxy CLI tool to install collection dependencies
|
||||
retry pip install ansible-core --disable-pip-version-check
|
||||
nox --verbose --install-only
|
||||
else
|
||||
nox --verbose --install-only -e "${nox_session}"
|
||||
fi
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
#!/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
|
||||
|
||||
set -o pipefail -eux
|
||||
|
||||
# Fix for https://github.com/ansible-community/antsibull-nox/issues/222#issuecomment-4778928615
|
||||
# caused by https://github.com/ansible/azure-pipelines-test-container/blob/7714d81f64f268bbb10779e1265d312128607b76/Containerfile#L4
|
||||
export PATH="${PATH//:~\//:${HOME}/}"
|
||||
|
||||
nox_session="$1"
|
||||
|
||||
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 ANTSIBULL_CHANGE_DETECTION=""
|
||||
elif [[ "${COMMIT_MESSAGE}" =~ ci_complete ]]; then
|
||||
# disable change detection triggered by having 'ci_complete' in the latest commit message
|
||||
export ANTSIBULL_CHANGE_DETECTION=""
|
||||
elif [ "${IS_PULL_REQUEST:-}" == "true" ]; then
|
||||
# enable change detection for PRs (default behavior)
|
||||
export ANTSIBULL_CHANGE_DETECTION="true"
|
||||
export ANTSIBULL_BASE_BRANCH="${SYSTEM_PULLREQUEST_TARGETBRANCH}"
|
||||
# Create a branch for the current HEAD, which happens to be a merge commit
|
||||
git checkout -b "pull-request-branch"
|
||||
# Name the target branch
|
||||
git branch "${SYSTEM_PULLREQUEST_TARGETBRANCH}" --track "origin/${SYSTEM_PULLREQUEST_TARGETBRANCH}"
|
||||
# Show branches
|
||||
git branch -vv
|
||||
else
|
||||
# disable change detection for pushes and scheduled runs
|
||||
export ANTSIBULL_CHANGE_DETECTION=""
|
||||
fi
|
||||
|
||||
if [[ "${COVERAGE:-}" == "--coverage" ]]; then
|
||||
export ANTSIBULL_NOX_TIMEOUT=60
|
||||
else
|
||||
export ANTSIBULL_NOX_TIMEOUT=50
|
||||
fi
|
||||
|
||||
if [ "${IS_PULL_REQUEST:-}" == "true" ]; then
|
||||
export ANTSIBULL_NOX_INTEGRATION_ALLOW_UNSTABLE_CHANGED="true"
|
||||
fi
|
||||
|
||||
export FORCE_COLOR=1
|
||||
export ANTSIBULL_NOX_IGNORE_INSTALLED_COLLECTIONS="true"
|
||||
export ANTSIBULL_NOX_COVERAGE_DESTINATION="${COVERAGE_DESTINATION_DIRECTORY}"
|
||||
export ANTSIBULL_NOX_COVERAGE_ANALYSIS_FILE="${COVERAGE_DESTINATION_DIRECTORY}/coverage-analyze-targets.json"
|
||||
export ANTSIBULL_NOX_COVERAGE_NO_XML="true"
|
||||
|
||||
if [ "${nox_session}" == "extra-sanity-tests" ]; then
|
||||
export ANTSIBULL_NOX_OUTPUT_BOT_DIRECTORY="tests/output/bot"
|
||||
nox --reuse-existing-virtualenvs --no-install
|
||||
else
|
||||
nox --reuse-existing-virtualenvs --no-install -e "${nox_session}" -- ${COVERAGE}
|
||||
fi
|
||||
Reference in New Issue
Block a user