Commit Graph

223 Commits

Author SHA1 Message Date
Alex Willmer 3a1b5ec620 CI: Increase sshd MaxAuthRetries to 50 on macOS runners
refs #1186
2024-11-07 00:32:01 +00:00
Alex Willmer 43cc937bc6 CI: Fix incorrect u=r,g=r,o=rw file permissions on mitogen__has_sudo_pubkey.key
The wrong base was used when calculating the mode. So the file became world
readable and writable on a CI runner, until
ansible/integration/ssh/variables.yml happened to correct it near the end of
the integration tests.

I believe this was the only instance.

```console
mitogen git:(issue1182) ✗ ag --python 'int\(.+7\)' . .ci | wc -l
       0
```

fixes #1182
2024-11-05 17:38:27 +00:00
Alex Willmer e9bddf0c03 CI: Use templated ansible_user for localhost Ansible tests
refs #1022, #1116
2024-10-11 08:52:25 +01:00
Alex Willmer 28e08ef94c ci: Reduce number of Jobs by parameterizing Mitogen Docker SSH tests
This reduces the number of jobs from 48 to 24. The Mitogen part of the test
suite has been parameterized on the Linux container targets to be run against.
Both the Ansible tests & Mitogen tests now use the same source of truth to
control which targets to use: environment variable MITOGEN_TEST_DISTRO_SPECS.
This replaces the two mutually exclusive env vars DISTRO and DISTROS. I've
also removed vestgial traces of an unused env var MITOGEN_TEST_DISTRO.

Parameterization adapted from
https://eli.thegreenplace.net/2014/04/02/dynamically-generating-python-test-cases

refs #1058, #1059
2024-10-10 18:37:16 +01:00
Alex Willmer 8362d61462 CI: Remove Azure DevOps pipelines (replaced by GitHub Actions)
fixes #1138
2024-10-07 12:47:29 +01:00
Alex Willmer 8b92e09655 ci: Extract container registry location into variables
Preperation for migrating from Azure DevOps with Amazon Elastic Container
Registry (AWS ECR), to GitHub Actions with GitHub Container Registry (GHCR).

DebOps tests are not currently being run, the updates to .ci/debops*.py are
best effort only.
2024-09-26 03:13:22 +01:00
Alex Willmer b926795973 ci: Move container registry authentication to an Azure Devops step
This aims to
- Reduce duplication
- Seperate CI specific setup from test setup
- Prepare for migration from Azure DevOps to GitHub Actions
2024-09-26 03:13:22 +01:00
Alex Willmer 4b4bfdc0f3 ci: Drop macOS Python 3.12 + Ansible 9 tests
They were meant to be replaced by Python 3.12 + ANsible 10, not supplemented.
2024-09-06 21:43:43 +01:00
Alex Willmer f3097b5743 ci: Template Ansible test-targets inventory with Jinja2 2024-09-06 11:31:25 +01:00
Alex Willmer 357fe38766 Ansible 10 (ansible-core 2.17) support
Notably
- Python 2.7 and 3.6 are no longer supported by Ansible on targets
- The yum module has been removed, and redirected to dnf
- _INTERPRETER_PYTHON_DISTRO_MAP has been neutered. Interpreter discovery
  always favours specific `python3.<x>` interpreters in decending version
  order, then generic `python3` or `python`.
- Add the ability for an action plugin to call self._execute_module(*,
  ignore_unknown_opts=True) to execute a module with options that may not be
  supported for the version being called.

https://docs.ansible.com/ansible/devel/porting_guides/porting_guide_10.html
https://github.com/ansible-community/ansible-build-data/blob/main/10/CHANGELOG-v10.md
https://github.com/ansible/ansible/blob/stable-2.17/changelogs/CHANGELOG-v2.17.rst

fixes #1074, refs #1082

Co-authored-by: Claude Becker <becker@phys.ethz.ch>
2024-08-11 16:21:05 +01:00
Alex Willmer 8613f685ab tests: Skip AWS ECR login outside of CI jobs
To avoid rate limiting errors, CI (currently Azure Devops) logs into the
container registry (currently AWS ECR). Outside CI this is unnnecessary and
makes it harder to run the tests, because very few people have access to a
suitable AWS secret token.

Following this change `aws ecr-public get-login-password` will only be run if
the environment variable $TF_BUILD==True. This is set by Azure Pipelines
jobs. If the CI platform is changed then another indicator should be used.

https://adamj.eu/tech/2020/03/09/detect-if-your-tests-are-running-on-ci/
2024-08-10 19:37:25 +01:00
Alex Willmer 924dbd6f0c CI: Migrate macOS integration tests to macOS 12, drop Python 2.7 jobs
macOS 11 is not longer an available runner on Azure Devops. The minimum is now
macOS 12. This runner does not have Python 2.7 installed, so running them
would require a custom install - which I'm declaring too much effort for too
little gain.

refs #1090
2024-07-29 11:26:15 +01:00
Alex Willmer 60f868290d
tests: Remove --limit when running Ansible localhost CI
Some tests were being incorrectly excluded. Including those that use
`add_host`.
refs #1066, #1069
2024-05-10 15:58:17 +02:00
Alex Willmer d5e9186289 ansible_mitogen: Fix --ask-become-pass, add test coverage
Previously f1503874de fixed the priority of
ansible_become_pass over ansible_become_password, but broke --ask-become-pass.
Fixes #952.
2024-04-12 10:47:45 +01:00
Alex Willmer cca651da1f ansible_mitogen: Ansible 9 (ansible-core 2.16) support 2024-04-05 22:33:05 +01:00
Alex Willmer fa1d21747f ansible_mitogen: Declare Ansible 8 (ansible-core 2.15) support
refs #1021
2024-04-05 12:54:41 +01:00
Alex Willmer 2333b9aced ci: Exclude docs-master branch 2024-04-05 12:54:41 +01:00
Orion Poplawski dfc3c7d516 ansible_mitogen: Add Ansible 7 support
Co-authored-by: Orion Poplawski <orion@nwra.com>
2024-04-04 09:11:23 +01:00
Alex Willmer 123efa7510 mitogen: Support Python 3.12
Most of the necessary changes were made in recent PEP 451 commits. This bumps
the CI jobs, and declares the support. Test dependendancies are bumped to
latest supportted/available versions.

refs #1033
2024-03-17 14:58:02 +00:00
Alex Willmer 92c00d913e tests: Skip "discovered python matches invoked" on macOS 11/Python 2.7/Vanilla 2024-03-17 14:58:01 +00:00
Alex Willmer 5ad3d14ceb mitogen: Support PEP 451 ModuleSpec API, required for Python 3.12
importlib.machinery.ModuleSpec and find_spec() were introduced in Python 3.4
under PEP 451. They replace the find_module() API of PEP 302, which was
deprecated from Python 3.4. They were removed in Python 3.12 along with the
imp module.

This change adds support for the PEP 451 APIs. Mitogen should no longer import
imp on Python versions that support ModuleSpec. Tests have been added to cover
the new APIs.

CI jobs have been added to cover Python 3.x on macOS.

Refs #1033
Co-authored-by: Witold Baryluk <witold.baryluk@gmail.com>
2024-03-17 14:57:57 +00:00
Alex Willmer f9a6748154 ci: Fix Python 2.7 builds on macOS 11
With current macOS 11 runner images (20231216.1) the `python` on `$PATH` is
Python 3.12 and setuptools isn't installed by default. E.g.

```
python -mtox -e "py27-mode_localhost-ansible4"
========================== Starting Command Output ===========================
/bin/bash --noprofile --norc
/Users/runner/work/_temp/93a29c4c-f606-45e4-8dbd-a4a5f51b8730.sh
GLOB sdist-make: /Users/runner/work/1/s/setup.py
ERROR: invocation failed (exit code 1), logfile:
/Users/runner/work/1/s/.tox/log/GLOB-0.log
================================== log start
===================================
Traceback (most recent call last):
  File "/Users/runner/work/1/s/setup.py", line 32, in <module>
    from setuptools import find_packages, setup
ModuleNotFoundError: No module named 'setuptools'
```

Installing setuptools under Python 3.12 chooses package versions incompatible
with Python 2.7. Additionally Mitogen isn't yet compatible with Python 3.12
(#1033), so tests that call a local context with `python` fail.
2024-01-10 10:04:10 +00:00
Alex Willmer 3f105d5169 ci: Authenticate UsePythonVersion requests to Github
This should address the warning in Azure Pipelines

> You should provide GitHub token if you want to download a python release.
> Otherwise you may hit the GitHub anonymous download limit.

The token is provided from a secret variable in the pipeline.
2023-10-05 13:27:34 +01:00
Nerijus Baliūnas 4089e875a9 Add Python 3.11 support
Co-authored-by: Alex Willmer <alex@moreati.org.uk>
2023-08-11 09:35:54 +01:00
Alex Willmer 49c54386b3 tests: Only use subprocess32 package on Python 2.x
This is how the package documentation recommends and it's less likely to
interfere with new features in stdlib subprocess module.
2023-08-10 09:31:32 +01:00
Alex Willmer 19b79f7ab5 CI: Fix tests on Linux, Ansible tests targetting Debian 9 & 11
Without Ubuntu 20.04 virtualenv package being installed pip was installing a
version of virtualenv that couldn't create the Tox environment for Python 2.7.

> Successfully installed distlib-0.3.6 filelock-3.12.2 platformdirs-3.8.0
> pluggy-1.2.0 py-1.11.0 tomli-2.0.1 tox-3.28.0 virtualenv-20.23.1
> Finishing: Install tooling
> ...
> py27-mode_mitogen-distro_centos6 create: /home/vsts/work/1/s/.tox/py27-
> mode_mitogen-distro_centos6
> ERROR: invocation failed (exit code 1), logfile: /home/vsts/work/1/s/.tox/
> py27-mode_mitogen-distro_centos6/log/py27-mode_mitogen-distro_centos6-0.log
> ================================== log start
> ===================================
> RuntimeError: failed to query /usr/bin/python2.7 with code 1 err:
> '  File "/home/vsts/.local/lib/python3.8/site-packages/virtualenv/discovery/
> py_info.py", line 24\n    return list(OrderedDict.fromkeys(["",
> *os.environ.get("PATHEXT", "").lower().split(os.pathsep)]))\n
> ^\nSyntaxError: invalid syntax\n'
2023-07-01 18:33:23 +01:00
Alex Willmer 8151577b75 CI: Limit to Tox < 4.0 to avoid plugin incompatibility
I'm abandoning tox-factor because having any [tox] requires = ... causes tox
3.x to create an isolated virtualenv for running tox itself. Since Tox 4.x was
released that virtualenv gets it, which is incompatible with the tox-factor
plugin.
e.g.
```
Traceback (most recent call last):
File
"/Users/runner/work/1/s/.tox/.tox/lib/python3.10/site-packages/tox_factor/compat.py",
line 2, in <module>
    from tox.config.parallel import ENV_VAR_KEY_PUBLIC as TOX_PARALLEL_ENV
ModuleNotFoundError: No module named 'tox.config.parallel'
```
2023-02-05 16:22:35 +00:00
Alex Willmer 392c41d160 ci: Ignore WALinuxAgent processes in Azure Piplines CI runner 2022-11-04 00:29:33 +00:00
Alex Willmer edd2868ef6 tests: Don't rely on facts when setting become
They won't be available if the play is first, and hence no facts have been
gather in previous play(s), e.g. due to --start-at-task
2022-09-12 19:59:51 +01:00
Alex Willmer 39dfd2dfe8 ci: Upgrade VM Images to macOS 11 and Ubuntu 20.04 2022-09-02 22:01:10 +01:00
Alex Willmer e8ad12e881 Ansible 6 support
fixes #929
2022-07-24 10:14:50 +01:00
Alex Willmer 195b400087 ci: Drop Ansible 3 tests to free up CI capacity 2022-07-24 10:14:50 +01:00
Alex Willmer 63e39c1ac5 ci: Remove traces of Ansible < 2.10 (not supported in 0.3.x) 2022-07-24 10:14:50 +01:00
Alex Willmer 64819ecb5f tests: Regression test for #776 (package/yum/dnf module called twice) 2022-07-17 13:44:05 +01:00
Alex Willmer c32577295a tests: Check and/or suppress stderr of subprocesses, reduce shell=True uses 2022-07-17 13:44:05 +01:00
Alex Willmer 18c89de5a9 Remove unused module imports 2022-04-23 10:01:06 +01:00
Alex Willmer 0417d4d73a Replace os.system() with subprocess.check_call()
Non-zero return codes should raise an exception, not pass silently.
2022-04-21 20:19:51 +01:00
Alex Willmer 2a95d039ab Python 3.10 support 2022-04-20 17:54:12 +01:00
Alex Willmer c9318a26f6 tests: Suppress pip version warnings 2022-04-20 14:10:40 +01:00
Alex Willmer 491458673b tests: Manage ANSIBLE_STRATEGY with Tox 2022-04-20 14:06:10 +01:00
Alex Willmer d424895344 ci: Drop Mac1014 jobs
The VM Image has been retired by Azure Pipelines.
2021-12-15 12:08:26 +00:00
Alex Willmer 77c306199c ci: Explicitly test on macOS-11 VM Image
As of writing this macOS-latest isn't quite yet upgraded, but warnings about
it are spewing out.
2021-12-15 12:07:00 +00:00
Klaus Zerwes b0610cb63c issue #874 ansible 2.12 requires min python 3.8 on the controller 2021-12-08 14:43:07 +01:00
Klaus Zerwes 40fc1f8a25 issue #874 try to implement the testst for ansible 2.12 2021-12-08 13:52:13 +01:00
Alex Willmer cadd393cd7 ci: Expand macOS coverage to 10.14, latest release on Azure Pipelines
10.14 will be retired on Azure mid December 2021. I want to get so test runs
while we can.
2021-12-05 18:32:45 +00:00
Alex Willmer 7bdec56a70 ci: One Tox environment per Azure job
Should result in
- better isolation of faults
- easier retries of failed jobs
- quicker test completion, to to more efficient queueing.

This does not expand test coverage, merely rearranges the tests already run.
2021-11-17 22:12:52 +00:00
Alex Willmer c61c063b4f Support for Ansible 3 & 4
fixes #834

Co-authored-by: Claude Becker (@upekkha)
Co-authored-by: Dolph Mathews (@dolph)
2021-11-12 22:10:53 +00:00
Alex Willmer c5c65ab0d2 ci: Switch Continuous Integration to Tox
Also
 - Simplifies adding support for additional Ansible versions
 - Unifies Python package versioning in CI and local test environments
 - Matches Python versions tested, with those declared in setup.py
 - Expands targets covered by automated Ansible tests to
    - centos6, centos8
    - debian9, debian11
    - ubuntu1604, ubuntu2004
2021-11-10 20:17:53 +00:00
Alex Willmer e76eefb8be Fix miscellaneous spelling/formatting 2021-11-09 22:17:16 +00:00
Alex Willmer 39d02e9d59 ci: Don't install pycparser and idna seperately
AFAICT no longer necessary. These install fine as part of requirements.txt.
2021-11-09 22:17:16 +00:00