Merge remote-tracking branch 'origin/master' into issue1086
commit
88eb64745e
@ -1,105 +0,0 @@
|
||||
# Each step entry runs a task (Azure Pipelines analog of an Ansible module).
|
||||
# https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/?view=azure-pipelines&viewFallbackFrom=azure-devops#tool
|
||||
|
||||
# `{script: ...}` is shorthand for `{task: CmdLine@<mumble>, inputs: {script: ...}}`.
|
||||
# The shell is bash.
|
||||
# https://learn.microsoft.com/en-us/azure/devops/pipelines/yaml-schema/steps-script?view=azure-pipelines
|
||||
# https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/cmd-line-v2?view=azure-pipelines
|
||||
|
||||
steps:
|
||||
- task: UsePythonVersion@0
|
||||
displayName: Install python
|
||||
inputs:
|
||||
githubToken: '$(GITHUB_PYVER_TOKEN)'
|
||||
versionSpec: '$(python.version)'
|
||||
condition: ne(variables['python.version'], '')
|
||||
|
||||
- script: |
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
aws ecr-public get-login-password | docker login --username AWS --password-stdin public.ecr.aws
|
||||
displayName: Authenticate to container registry
|
||||
condition: eq(variables['Agent.OS'], 'Linux')
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: $(AWS_ACCESS_KEY_ID)
|
||||
AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY)
|
||||
AWS_DEFAULT_REGION: $(AWS_DEFAULT_REGION)
|
||||
|
||||
- script: |
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y python2-dev python3-pip virtualenv
|
||||
displayName: Install build deps
|
||||
condition: and(eq(variables['python.version'], ''), eq(variables['Agent.OS'], 'Linux'))
|
||||
|
||||
- script: |
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
# macOS builders lack a realpath command
|
||||
type python && python -c"import os.path;print(os.path.realpath('$(type -p python)'))" && python --version
|
||||
type python2 && python2 -c"import os.path;print(os.path.realpath('$(type -p python2)'))" && python2 --version
|
||||
type python3 && python3 -c"import os.path;print(os.path.realpath('$(type -p python3)'))" && python3 --version
|
||||
echo
|
||||
|
||||
if [ -e /usr/bin/python ]; then
|
||||
echo "/usr/bin/python: sys.executable: $(/usr/bin/python -c 'import sys; print(sys.executable)')"
|
||||
fi
|
||||
|
||||
if [ -e /usr/bin/python2 ]; then
|
||||
echo "/usr/bin/python2: sys.executable: $(/usr/bin/python2 -c 'import sys; print(sys.executable)')"
|
||||
fi
|
||||
|
||||
if [ -e /usr/bin/python2.7 ]; then
|
||||
echo "/usr/bin/python2.7: sys.executable: $(/usr/bin/python2.7 -c 'import sys; print(sys.executable)')"
|
||||
fi
|
||||
displayName: Show python versions
|
||||
|
||||
- script: |
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
# Tox environment name (e.g. py312-mode_mitogen) -> Python executable name (e.g. python3.12)
|
||||
PYTHON=$(python -c 'import re; print(re.sub(r"^py([23])([0-9]{1,2}).*", r"python\1.\2", "$(tox.env)"))')
|
||||
|
||||
if [[ -z $PYTHON ]]; then
|
||||
echo 1>&2 "Python interpreter could not be determined"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $PYTHON == "python2.7" && $(uname) == "Darwin" ]]; then
|
||||
"$PYTHON" -m ensurepip --user --altinstall --no-default-pip
|
||||
"$PYTHON" -m pip install --user -r "tests/requirements-tox.txt"
|
||||
elif [[ $PYTHON == "python2.7" ]]; then
|
||||
curl "https://bootstrap.pypa.io/pip/2.7/get-pip.py" --output "get-pip.py"
|
||||
"$PYTHON" get-pip.py --user --no-python-version-warning
|
||||
# Avoid Python 2.x pip masking system pip
|
||||
rm -f ~/.local/bin/{easy_install,pip,wheel}
|
||||
"$PYTHON" -m pip install --user -r "tests/requirements-tox.txt"
|
||||
else
|
||||
"$PYTHON" -m pip install -r "tests/requirements-tox.txt"
|
||||
fi
|
||||
displayName: Install tooling
|
||||
|
||||
- script: |
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
# Tox environment name (e.g. py312-mode_mitogen) -> Python executable name (e.g. python3.12)
|
||||
PYTHON=$(python -c 'import re; print(re.sub(r"^py([23])([0-9]{1,2}).*", r"python\1.\2", "$(tox.env)"))')
|
||||
|
||||
if [[ -z $PYTHON ]]; then
|
||||
echo 1>&2 "Python interpreter could not be determined"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
"$PYTHON" -m tox -e "$(tox.env)"
|
||||
displayName: "Run tests"
|
@ -1,157 +0,0 @@
|
||||
# Python package
|
||||
# Create and test a Python package on multiple Python versions.
|
||||
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
|
||||
# https://docs.microsoft.com/azure/devops/pipelines/languages/python
|
||||
|
||||
# User defined variables are also injected as environment variables
|
||||
# https://docs.microsoft.com/en-us/azure/devops/pipelines/process/variables#environment-variables
|
||||
#variables:
|
||||
#ANSIBLE_VERBOSITY: 3
|
||||
|
||||
trigger:
|
||||
branches:
|
||||
include:
|
||||
- "*"
|
||||
exclude:
|
||||
- docs-master
|
||||
|
||||
jobs:
|
||||
- job: mac12
|
||||
# vanilla Ansible is really slow
|
||||
timeoutInMinutes: 120
|
||||
steps:
|
||||
- template: azure-pipelines-steps.yml
|
||||
pool:
|
||||
# https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md
|
||||
vmImage: macOS-12
|
||||
strategy:
|
||||
matrix:
|
||||
Mito_312:
|
||||
tox.env: py312-mode_mitogen
|
||||
Loc_312_10:
|
||||
tox.env: py312-mode_localhost-ansible10
|
||||
Van_312_10:
|
||||
tox.env: py312-mode_localhost-ansible10-strategy_linear
|
||||
|
||||
- job: Linux
|
||||
pool:
|
||||
# https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2004-Readme.md
|
||||
vmImage: ubuntu-20.04
|
||||
steps:
|
||||
- template: azure-pipelines-steps.yml
|
||||
strategy:
|
||||
matrix:
|
||||
Mito_27_centos6:
|
||||
tox.env: py27-mode_mitogen-distro_centos6
|
||||
Mito_27_centos7:
|
||||
tox.env: py27-mode_mitogen-distro_centos7
|
||||
Mito_27_centos8:
|
||||
tox.env: py27-mode_mitogen-distro_centos8
|
||||
Mito_27_debian9:
|
||||
tox.env: py27-mode_mitogen-distro_debian9
|
||||
Mito_27_debian10:
|
||||
tox.env: py27-mode_mitogen-distro_debian10
|
||||
Mito_27_debian11:
|
||||
tox.env: py27-mode_mitogen-distro_debian11
|
||||
Mito_27_ubuntu1604:
|
||||
tox.env: py27-mode_mitogen-distro_ubuntu1604
|
||||
Mito_27_ubuntu1804:
|
||||
tox.env: py27-mode_mitogen-distro_ubuntu1804
|
||||
Mito_27_ubuntu2004:
|
||||
tox.env: py27-mode_mitogen-distro_ubuntu2004
|
||||
|
||||
Mito_36_centos6:
|
||||
python.version: '3.6'
|
||||
tox.env: py36-mode_mitogen-distro_centos6
|
||||
Mito_36_centos7:
|
||||
python.version: '3.6'
|
||||
tox.env: py36-mode_mitogen-distro_centos7
|
||||
Mito_36_centos8:
|
||||
python.version: '3.6'
|
||||
tox.env: py36-mode_mitogen-distro_centos8
|
||||
Mito_36_debian9:
|
||||
python.version: '3.6'
|
||||
tox.env: py36-mode_mitogen-distro_debian9
|
||||
Mito_36_debian10:
|
||||
python.version: '3.6'
|
||||
tox.env: py36-mode_mitogen-distro_debian10
|
||||
Mito_36_debian11:
|
||||
python.version: '3.6'
|
||||
tox.env: py36-mode_mitogen-distro_debian11
|
||||
Mito_36_ubuntu1604:
|
||||
python.version: '3.6'
|
||||
tox.env: py36-mode_mitogen-distro_ubuntu1604
|
||||
Mito_36_ubuntu1804:
|
||||
python.version: '3.6'
|
||||
tox.env: py36-mode_mitogen-distro_ubuntu1804
|
||||
Mito_36_ubuntu2004:
|
||||
python.version: '3.6'
|
||||
tox.env: py36-mode_mitogen-distro_ubuntu2004
|
||||
|
||||
Mito_312_centos6:
|
||||
python.version: '3.12'
|
||||
tox.env: py312-mode_mitogen-distro_centos6
|
||||
Mito_312_centos7:
|
||||
python.version: '3.12'
|
||||
tox.env: py312-mode_mitogen-distro_centos7
|
||||
Mito_312_centos8:
|
||||
python.version: '3.12'
|
||||
tox.env: py312-mode_mitogen-distro_centos8
|
||||
Mito_312_debian9:
|
||||
python.version: '3.12'
|
||||
tox.env: py312-mode_mitogen-distro_debian9
|
||||
Mito_312_debian10:
|
||||
python.version: '3.12'
|
||||
tox.env: py312-mode_mitogen-distro_debian10
|
||||
Mito_312_debian11:
|
||||
python.version: '3.12'
|
||||
tox.env: py312-mode_mitogen-distro_debian11
|
||||
Mito_312_ubuntu1604:
|
||||
python.version: '3.12'
|
||||
tox.env: py312-mode_mitogen-distro_ubuntu1604
|
||||
Mito_312_ubuntu1804:
|
||||
python.version: '3.12'
|
||||
tox.env: py312-mode_mitogen-distro_ubuntu1804
|
||||
Mito_312_ubuntu2004:
|
||||
python.version: '3.12'
|
||||
tox.env: py312-mode_mitogen-distro_ubuntu2004
|
||||
|
||||
Ans_27_210:
|
||||
tox.env: py27-mode_ansible-ansible2.10
|
||||
Ans_27_4:
|
||||
tox.env: py27-mode_ansible-ansible4
|
||||
|
||||
Ans_36_210:
|
||||
python.version: '3.6'
|
||||
tox.env: py36-mode_ansible-ansible2.10
|
||||
Ans_36_4:
|
||||
python.version: '3.6'
|
||||
tox.env: py36-mode_ansible-ansible4
|
||||
|
||||
Ans_311_210:
|
||||
python.version: '3.11'
|
||||
tox.env: py311-mode_ansible-ansible2.10
|
||||
Ans_311_3:
|
||||
python.version: '3.11'
|
||||
tox.env: py311-mode_ansible-ansible3
|
||||
Ans_311_4:
|
||||
python.version: '3.11'
|
||||
tox.env: py311-mode_ansible-ansible4
|
||||
Ans_311_5:
|
||||
python.version: '3.11'
|
||||
tox.env: py311-mode_ansible-ansible5
|
||||
Ans_312_6:
|
||||
python.version: '3.12'
|
||||
tox.env: py312-mode_ansible-ansible6
|
||||
Ans_312_7:
|
||||
python.version: '3.12'
|
||||
tox.env: py312-mode_ansible-ansible7
|
||||
Ans_312_8:
|
||||
python.version: '3.12'
|
||||
tox.env: py312-mode_ansible-ansible8
|
||||
Ans_312_9:
|
||||
python.version: '3.12'
|
||||
tox.env: py312-mode_ansible-ansible9
|
||||
Ans_312_10:
|
||||
python.version: '3.12'
|
||||
tox.env: py312-mode_ansible-ansible10
|
@ -0,0 +1,18 @@
|
||||
# Ansible removed its default SSH port in May 2021, defering to the SSH
|
||||
# implementation.
|
||||
# https://github.com/ansible/ansible/commit/45618a6f3856f7332df8afe4adc40d85649a70da
|
||||
|
||||
# Careful templating is needed to preseve the type(s) of expected_ssh_port,
|
||||
# particularly in combination with the assert_equal action plugin.
|
||||
# Do: {{ expected_ssh_port }}
|
||||
# Don't: {{ expected_ssh_port | any_filter }}
|
||||
# Don't: {% if ...%}{{ expected_ssh_port }}{% else %}...{% endif %}
|
||||
# https://stackoverflow.com/questions/66102524/ansible-set-fact-type-cast/66104814#66104814
|
||||
|
||||
- set_fact:
|
||||
expected_ssh_port: null
|
||||
when: ansible_version.full is version('2.11.1', '>=', strict=True)
|
||||
|
||||
- set_fact:
|
||||
expected_ssh_port: 22
|
||||
when: ansible_version.full is version('2.11.1', '<', strict=True)
|
@ -0,0 +1,34 @@
|
||||
- name: integration/become/templated_by_inv.yml
|
||||
hosts: tt_become_by_inv
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Gather facts (avoiding any unprivileged become)
|
||||
vars:
|
||||
ansible_become: false
|
||||
setup:
|
||||
|
||||
- meta: reset_connection
|
||||
|
||||
- name: Templated become in inventory
|
||||
vars:
|
||||
expected_become_users:
|
||||
tt-become: root
|
||||
tt-become-exe: root
|
||||
tt-become-flags: root
|
||||
tt-become-method: root
|
||||
tt-become-pass: mitogen__pw_required
|
||||
tt-become-user: root
|
||||
command:
|
||||
cmd: whoami
|
||||
changed_when: false
|
||||
check_mode: false
|
||||
register: become_templated_by_inv_whoami
|
||||
failed_when:
|
||||
- become_templated_by_inv_whoami is failed
|
||||
or become_templated_by_inv_whoami.stdout != expected_become_users[inventory_hostname]
|
||||
when:
|
||||
# https://github.com/ansible/ansible/pull/70785
|
||||
- ansible_become_user in ['root']
|
||||
or ansible_facts.distribution not in ["MacOSX"]
|
||||
or ansible_version.full is version("2.11", ">=", strict=True)
|
||||
or is_mitogen
|
@ -0,0 +1,53 @@
|
||||
- name: integration/become/templated_by_play_keywords.yml
|
||||
hosts: tt_become_bare
|
||||
gather_facts: false
|
||||
become: "{{ 'true' | trim }}"
|
||||
become_exe: "{{ 'sudo' | trim }}"
|
||||
become_flags: "{{ '--set-home --stdin --non-interactive' | trim }}"
|
||||
become_method: "{{ 'sudo' | trim }}"
|
||||
become_user: "{{ 'root' | trim }}"
|
||||
tasks:
|
||||
- meta: reset_connection
|
||||
|
||||
- name: Templated become by play keywords, no password
|
||||
command:
|
||||
cmd: whoami
|
||||
changed_when: false
|
||||
check_mode: false
|
||||
register: become_templated_by_play_keywords_whoami
|
||||
failed_when:
|
||||
- become_templated_by_play_keywords_whoami is failed
|
||||
or become_templated_by_play_keywords_whoami.stdout != 'root'
|
||||
|
||||
- name: integration/become/templated_by_play_keywords.yml
|
||||
hosts: tt_become_bare
|
||||
gather_facts: false
|
||||
become: "{{ 'true' | trim }}"
|
||||
become_exe: "{{ 'sudo' | trim }}"
|
||||
become_flags: "{{ '--set-home --stdin --non-interactive' | trim }}"
|
||||
become_method: "{{ 'sudo' | trim }}"
|
||||
become_user: "{{ 'mitogen__pw_required' | trim }}"
|
||||
vars:
|
||||
ansible_become_pass: "{{ 'pw_required_password' | trim }}"
|
||||
tasks:
|
||||
- name: Gather facts (avoiding any unprivileged become)
|
||||
vars:
|
||||
ansible_become: false
|
||||
setup:
|
||||
|
||||
- meta: reset_connection
|
||||
|
||||
- name: Templated become by play keywords, password
|
||||
command:
|
||||
cmd: whoami
|
||||
changed_when: false
|
||||
check_mode: false
|
||||
register: become_templated_by_play_keywords_password_whoami
|
||||
failed_when:
|
||||
- become_templated_by_play_keywords_password_whoami is failed
|
||||
or become_templated_by_play_keywords_password_whoami.stdout != 'mitogen__pw_required'
|
||||
when:
|
||||
# https://github.com/ansible/ansible/pull/70785
|
||||
- ansible_facts.distribution not in ["MacOSX"]
|
||||
or ansible_version.full is version("2.11", ">=", strict=True)
|
||||
or is_mitogen
|
@ -0,0 +1,52 @@
|
||||
- name: integration/become/templated_by_play_vars.yml
|
||||
hosts: tt_become_bare
|
||||
gather_facts: false
|
||||
vars:
|
||||
ansible_become: true
|
||||
ansible_become_exe: "{{ 'sudo' | trim }}"
|
||||
ansible_become_flags: "{{ '--set-home --stdin --non-interactive' | trim }}"
|
||||
ansible_become_method: "{{ 'sudo' | trim }}"
|
||||
ansible_become_user: "{{ 'root' | trim }}"
|
||||
tasks:
|
||||
- name: Templated become by play vars, no password
|
||||
command:
|
||||
cmd: whoami
|
||||
changed_when: false
|
||||
check_mode: false
|
||||
register: become_templated_by_play_vars_whoami
|
||||
failed_when:
|
||||
- become_templated_by_play_vars_whoami is failed
|
||||
or become_templated_by_play_vars_whoami.stdout != 'root'
|
||||
|
||||
- name: integration/become/templated_by_play_vars.yml
|
||||
hosts: tt_become_bare
|
||||
gather_facts: false
|
||||
vars:
|
||||
ansible_become: true
|
||||
ansible_become_exe: "{{ 'sudo' | trim }}"
|
||||
ansible_become_flags: "{{ '--set-home --stdin --non-interactive' | trim }}"
|
||||
ansible_become_method: "{{ 'sudo' | trim }}"
|
||||
ansible_become_pass: "{{ 'pw_required_password' | trim }}"
|
||||
ansible_become_user: "{{ 'mitogen__pw_required' | trim }}"
|
||||
tasks:
|
||||
- name: Gather facts (avoiding any unprivileged become)
|
||||
vars:
|
||||
ansible_become: false
|
||||
setup:
|
||||
|
||||
- meta: reset_connection
|
||||
|
||||
- name: Templated become by play vars, password
|
||||
command:
|
||||
cmd: whoami
|
||||
changed_when: false
|
||||
check_mode: false
|
||||
register: become_templated_by_play_vars_password_whoami
|
||||
failed_when:
|
||||
- become_templated_by_play_vars_password_whoami is failed
|
||||
or become_templated_by_play_vars_password_whoami.stdout != 'mitogen__pw_required'
|
||||
when:
|
||||
# https://github.com/ansible/ansible/pull/70785
|
||||
- ansible_facts.distribution not in ["MacOSX"]
|
||||
or ansible_version.full is version("2.11", ">=", strict=True)
|
||||
or is_mitogen
|
@ -0,0 +1,83 @@
|
||||
- name: integration/become/templated_by_task_keywords.yml
|
||||
hosts: tt_become_bare
|
||||
gather_facts: false
|
||||
# FIXME Resetting the connection shouldn't require credentials
|
||||
# https://github.com/mitogen-hq/mitogen/issues/1132
|
||||
become: "{{ 'true' | trim }}"
|
||||
become_exe: "{{ 'sudo' | trim }}"
|
||||
become_flags: "{{ '--set-home --stdin --non-interactive' | trim }}"
|
||||
become_method: "{{ 'sudo' | trim }}"
|
||||
become_user: "{{ 'root' | trim }}"
|
||||
tasks:
|
||||
- name: Reset connection to target that will be delegate_to
|
||||
meta: reset_connection
|
||||
|
||||
- name: Test connection template by task keywords, with delegate_to
|
||||
hosts: test-targets[0]
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Templated become by task keywords, with delegate_to
|
||||
become: "{{ 'true' | trim }}"
|
||||
become_exe: "{{ 'sudo' | trim }}"
|
||||
become_flags: "{{ '--set-home --stdin --non-interactive' | trim }}"
|
||||
become_method: "{{ 'sudo' | trim }}"
|
||||
become_user: "{{ 'root' | trim }}"
|
||||
delegate_to: "{{ groups.tt_become_bare[0] }}"
|
||||
command:
|
||||
cmd: whoami
|
||||
changed_when: false
|
||||
check_mode: false
|
||||
register: become_templated_by_task_with_delegate_to_whoami
|
||||
failed_when:
|
||||
- become_templated_by_task_with_delegate_to_whoami is failed
|
||||
or become_templated_by_task_with_delegate_to_whoami.stdout != 'root'
|
||||
|
||||
|
||||
- name: integration/become/templated_by_task_keywords.yml
|
||||
hosts: tt_become_bare
|
||||
gather_facts: false
|
||||
# FIXME Resetting the connection shouldn't require credentials
|
||||
# https://github.com/mitogen-hq/mitogen/issues/1132
|
||||
become: "{{ 'true' | trim }}"
|
||||
become_exe: "{{ 'sudo' | trim }}"
|
||||
become_flags: "{{ '--set-home --stdin --non-interactive' | trim }}"
|
||||
become_method: "{{ 'sudo' | trim }}"
|
||||
become_user: "{{ 'mitogen__pw_required' | trim }}"
|
||||
vars:
|
||||
ansible_become_pass: "{{ 'pw_required_password' | trim }}"
|
||||
tasks:
|
||||
- name: Reset connection to target that will be delegate_to
|
||||
meta: reset_connection
|
||||
|
||||
- name: Test connection template by task keywords, with delegate_to
|
||||
hosts: test-targets[0]
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Gather facts (avoiding any unprivileged become)
|
||||
delegate_to: "{{ groups.tt_become_bare[0] }}"
|
||||
vars:
|
||||
ansible_become: false
|
||||
setup:
|
||||
|
||||
- name: Templated become by task keywords, with delegate_to
|
||||
become: "{{ 'true' | trim }}"
|
||||
become_exe: "{{ 'sudo' | trim }}"
|
||||
become_flags: "{{ '--set-home --stdin --non-interactive' | trim }}"
|
||||
become_method: "{{ 'sudo' | trim }}"
|
||||
become_user: "{{ 'mitogen__pw_required' | trim }}"
|
||||
delegate_to: "{{ groups.tt_become_bare[0] }}"
|
||||
vars:
|
||||
ansible_become_pass: "{{ 'pw_required_password' | trim }}"
|
||||
command:
|
||||
cmd: whoami
|
||||
changed_when: false
|
||||
check_mode: false
|
||||
register: become_templated_by_task_with_delegate_to_password_whoami
|
||||
failed_when:
|
||||
- become_templated_by_task_with_delegate_to_password_whoami is failed
|
||||
or become_templated_by_task_with_delegate_to_password_whoami.stdout != 'mitogen__pw_required'
|
||||
when:
|
||||
# https://github.com/ansible/ansible/pull/70785
|
||||
- ansible_facts.distribution not in ["MacOSX"]
|
||||
or ansible_version.full is version("2.11", ">=", strict=True)
|
||||
or is_mitogen
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue