Skip to content

Commit

Permalink
Test maintained versions of ansible-core.
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-de-bock committed Jul 24, 2024
1 parent 35092de commit 55e6cea
Show file tree
Hide file tree
Showing 9 changed files with 120 additions and 32 deletions.
55 changes: 49 additions & 6 deletions .github/workflows/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,57 @@ jobs:
uses: actions/checkout@v4
- name: ansible-lint
uses: ansible-community/ansible-lint-action@main
test:

python-3-9:
needs:
- lint
runs-on: ubuntu-20.04
container:
image: python:3.9
strategy:
fail-fast: false
matrix:
config:
- image: "debian"
tag: "bullseye"
- image: "enterpriselinux"
tag: "8"
tag: "latest"
- image: "fedora"
tag: "38"
- image: "fedora"
tag: "39"
- image: "ubuntu"
tag: "latest"
- image: "ubuntu"
tag: "jammy"
- image: "ubuntu"
tag: "focal"
steps:
- name: checkout
uses: actions/checkout@v4

- name: molecule
run: |
apt-get update -qq
apt-get -y -qq install yamllint docker.io
pip install --no-cache-dir tox
if [ -f tox.ini ] ; then tox ; fi
if [ ! -f tox.ini ] ; then pip install -r requirements.yml ; pip install ansible-lint ansible-core ; molecule test ; fi
env:
image: ${{ matrix.config.image }}
tag: ${{ matrix.config.tag }}
python-3-10:
needs:
- lint
runs-on: ubuntu-20.04
container:
image: python:3.10
strategy:
fail-fast: false
matrix:
config:
- image: "debian"
tag: "bullseye"
- image: "enterpriselinux"
tag: "latest"
- image: "fedora"
Expand All @@ -48,10 +87,14 @@ jobs:
steps:
- name: checkout
uses: actions/checkout@v4
with:
path: "${{ github.repository }}"

- name: molecule
uses: robertdebock/molecule-action@6.0.1
with:
run: |
apt-get update -qq
apt-get -y -qq install yamllint docker.io
pip install --no-cache-dir tox
if [ -f tox.ini ] ; then tox ; fi
if [ ! -f tox.ini ] ; then pip install -r requirements.yml ; pip install ansible-lint ansible-core ; molecule test ; fi
env:
image: ${{ matrix.config.image }}
tag: ${{ matrix.config.tag }}
18 changes: 13 additions & 5 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,41 @@
---
image: "robertdebock/github-action-molecule:6.0.1"

variables:
PY_COLORS: 1
DEBIAN_FRONTEND: noninteractive

molecule:
image: $python
script:
- apt-get update -qq
- apt-get -y -qq install yamllint docker.io
- pip install --no-cache-dir tox
- if [ -f tox.ini ] ; then tox ; fi
- if [ ! -f tox.ini ] ; then molecule test ; fi
- if [ ! -f tox.ini ] ; then pip install -r requirements.yml ; pip install ansible-lint ansible-core ; molecule test ; fi
rules:
- if: $CI_COMMIT_REF_NAME == "master"
parallel:
matrix:
- image: "debian"
tag: "bullseye"
- image: "enterpriselinux"
tag: "8"
python: ['python:3.9', 'python:3.10']
- image: "enterpriselinux"
tag: "latest"
python: ['python:3.9', 'python:3.10']
- image: "fedora"
tag: "38"
python: ['python:3.9', 'python:3.10']
- image: "fedora"
tag: "39"
python: ['python:3.9', 'python:3.10']
- image: "ubuntu"
tag: "latest"
python: ['python:3.9', 'python:3.10']
- image: "ubuntu"
tag: "jammy"
python: ['python:3.9', 'python:3.10']
- image: "ubuntu"
tag: "focal"
python: ['python:3.9', 'python:3.10']

galaxy:
script:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ This role has been tested on these [container images](https://hub.docker.com/u/r
|container|tags|
|---------|----|
|[Debian](https://hub.docker.com/r/robertdebock/debian)|bullseye|
|[EL](https://hub.docker.com/r/robertdebock/enterpriselinux)|8, 9|
|[EL](https://hub.docker.com/r/robertdebock/enterpriselinux)|9|
|[Fedora](https://hub.docker.com/r/robertdebock/fedora)|38, 39|
|[Ubuntu](https://hub.docker.com/r/robertdebock/ubuntu)|all|
Expand Down
1 change: 0 additions & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ galaxy_info:
- bullseye
- name: EL
versions:
- "8"
- "9"
- name: Fedora
versions:
Expand Down
17 changes: 5 additions & 12 deletions meta/preferences.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
---
# This file is used by [`ansible-generator`](https://github.com/robertdebock/ansible-generator).

# Overrule the Ansible versions that [tox](https://pypi.org/project/tox/) should test. Not mentioning this variable will use the [default Ansible version](https://github.com/robertdebock/ansible-generator/blob/master/templates/tox.ini.j2#L7).
# tox_ansible_versions:
# - 6
# - 7

# You can pass variables from GitHub ([Action secrets](https://docs.github.com/en/rest/actions/secrets) for example).
# github_variables_mapping:
# - name: secrets.VAULT_LICENSE
# variable: VAULT_LICENCE
# - name: secrets.MY_VAR
# variable: someTHING
matrix_overrides:
amazonlinux:
python:
- python:3.9
- python:3.10
2 changes: 1 addition & 1 deletion molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ platforms:
image: "${namespace:-robertdebock}/${image:-fedora}:${tag:-latest}"
command: /sbin/init
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- /sys/fs/cgroup:/sys/fs/cgroup:rw
privileged: true
pre_build_image: true
provisioner:
Expand Down
8 changes: 3 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
ansible-compat == 4.*
molecule == 6.*
molecule-plugins[docker] == 23.*
ansible-lint == 6.*
paramiko == 3.*
molecule
molecule-plugins[docker]
paramiko
1 change: 0 additions & 1 deletion requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ roles:
- name: robertdebock.core_dependencies
- name: robertdebock.docker_ce
- name: robertdebock.docker_compose

collections:
- name: community.docker
- name: community.general
48 changes: 48 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[tox]
envlist = ansible-2.{15,16,17}
skipsdist = true

[testenv]
commands = molecule test

setenv =
TOX_ENVNAME={envname}
PY_COLORS=1
ANSIBLE_FORCE_COLOR=1
ANSIBLE_ROLES_PATH=../

passenv = namespace, image, tag, DOCKER_HOST

# Test supported releases of ansible-core. See:
# https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html#ansible-core-support-matrix

[testenv:ansible-2.15]
basepython = python3.9
deps =
-rrequirements.txt
ansible-core==2.15.*
ansible-lint==6.*

[testenv:ansible-2.16]
basepython = python3.10
deps =
-rrequirements.txt
ansible-core==2.16.*
ansible-lint==24.*

[testenv:ansible-2.17]
basepython = python3.10
deps =
-rrequirements.txt
ansible-core==2.17.*
ansible-lint==24.*

# Future work, not releases, just prepared. See:
# https://docs.ansible.com/ansible/devel//roadmap/ROADMAP_2_18.html
# Note: enable python3.13 in `vars/main.yml` as well.
# [testenv:ansible-2.18]
# basepython = python3.13
# deps =
# -rrequirements.txt
# ansible-core==2.18.*
# ansible-lint==24.*

0 comments on commit 55e6cea

Please sign in to comment.