Skip to content

ansible-test images #581

ansible-test images

ansible-test images #581

Workflow file for this run

---
name: ansible-test images
on:
push:
branches:
- main
paths:
- .github/workflows/ansible-test.yml
- ansible-test/**
pull_request:
branches:
- main
paths:
- .github/workflows/ansible-test.yml
- ansible-test/**
workflow_dispatch:
# Run daily (Monday at 08:00 UTC)
schedule:
- cron: '0 8 * * *'
env:
CONTAINER_REGISTRY: quay.io
CONTAINER_IMAGE_NAME: ansible-community/test-image
jobs:
build:
name: 'Build ansible-test images (${{ matrix.name }} with Python ${{ matrix.python }})'
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
include:
- name: archlinux
python: '3.12'
ansible-core-1: ansible-core
ansible-core-2: devel
test-with-podman: true
test-with-docker: true
- name: debian-bullseye
python: '3.9'
ansible-core-1: ansible-core
ansible-core-2: devel
test-with-podman: true
test-with-docker: true
- name: debian-bookworm
python: '3.11'
ansible-core-1: ansible-core
ansible-core-2: devel
test-with-podman: true
test-with-docker: true
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
sudo apt-get install podman buildah
pip install ${{ matrix.ansible-core-1 }}
- name: Build ${{ matrix.name }} image
run: |
${{ matrix.name }}/build.sh
podman tag localhost/test-image:${{ matrix.name }} "${CONTAINER_REGISTRY}/${CONTAINER_IMAGE_NAME}:${{ matrix.name }}"
working-directory: ./ansible-test/
# This is necessary to allow running systemd in rootless containers
- name: Start systemd user service
run: |
loginctl enable-linger runner
sleep 1
- name: Run basic tests with ${{ matrix.name }} image (${{ matrix.ansible-core-1 }}, Python versions ${{ matrix.python }}, Podman)
if: ${{ matrix.test-with-podman }}
env:
ANSIBLE_TEST_PREFER_PODMAN: 1
run: |
for PYTHON in ${{ matrix.python }}; do
ansible-test integration --color -v --python ${PYTHON} --docker localhost/test-image:${{ matrix.name }} shippable/posix/group1/
done
working-directory: ./.github/ansible-test-tests/ansible_collections/testns/testcol
- name: Copy image from podman to docker
if: ${{ matrix.test-with-docker }}
run: |
podman push localhost/test-image:${{ matrix.name }} docker-daemon:localhost/test-image:${{ matrix.name }}
- name: Install ansible-core ${{ matrix.ansible-core-2 }}
if: ${{ matrix.test-with-docker }}
run: |
pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible-core-2 }}.tar.gz
- name: Run basic tests with ${{ matrix.name }} image (ansible-core ${{ matrix.ansible-core-2 }}, Python versions ${{ matrix.python }}, Docker)
if: ${{ matrix.test-with-docker }}
run: |
for PYTHON in ${{ matrix.python }}; do
ansible-test integration --color -v --python ${PYTHON} --docker localhost/test-image:${{ matrix.name }} shippable/posix/group1/
done
working-directory: ./.github/ansible-test-tests/ansible_collections/testns/testcol
- name: Publish container image as ${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_IMAGE_NAME }}:${{ matrix.name }}
if: github.event_name != 'pull_request'
uses: redhat-actions/push-to-registry@v2
with:
registry: ${{ env.CONTAINER_REGISTRY }}
image: ${{ env.CONTAINER_IMAGE_NAME }}
tags: ${{ matrix.name }}
username: ${{ secrets.quay_write_user }}
password: ${{ secrets.quay_write_pass }}