1
0
Fork 0
mirror of https://github.com/containers/ansible-podman-collections.git synced 2026-02-04 07:11:49 +00:00

Rewrite podman and buildah connections (#962)

* Rewrite podman and buildah connections

---------

Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
This commit is contained in:
Sergey 2025-09-11 20:35:09 +03:00 committed by GitHub
parent 237bc385b9
commit 991e461ea5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
38 changed files with 2966 additions and 344 deletions

View file

@ -4,6 +4,7 @@ on:
push:
paths:
- '.github/workflows/connections_tests.yml'
- '.github/actions/setup-ansible-collection/action.yml'
- 'ci/*.yml'
- 'ci/playbooks/connections/**'
- 'ci/run_connection_test.sh'
@ -15,6 +16,7 @@ on:
pull_request:
paths:
- '.github/workflows/connections_tests.yml'
- '.github/actions/setup-ansible-collection/action.yml'
- 'ci/*.yml'
- 'ci/playbooks/connections/**'
- 'ci/run_connection_test.sh'
@ -76,7 +78,7 @@ jobs:
fail-fast: false
matrix:
ansible-version:
- git+https://github.com/ansible/ansible.git@stable-2.17
- git+https://github.com/ansible/ansible.git@stable-2.18
- git+https://github.com/ansible/ansible.git@devel
os:
- ubuntu-22.04
@ -84,66 +86,30 @@ jobs:
#- ubuntu-16.04
#- macos-latest
python-version:
- "3.11"
- "3.12"
# - 3.9
#- 3.6
#- 3.5
#- 2.7
include:
- os: ubuntu-22.04
ansible-version: git+https://github.com/ansible/ansible.git@devel
python-version: "3.12"
exclude:
- os: ubuntu-22.04
ansible-version: git+https://github.com/ansible/ansible.git@devel
python-version: "3.11"
steps:
- name: Check out repository
uses: actions/checkout@v5
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
- name: Setup Python/Ansible and install built collection
uses: ./.github/actions/setup-ansible-collection
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip and display Python and PIP versions
run: |
python -m pip install --upgrade pip
python -V
pip --version
- name: Set up pip cache
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ github.ref }}-units-VMs
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install Ansible ${{ matrix.ansible-version }}
run: python -m pip install --user '${{ matrix.ansible-version }}'
- name: Download migrated collection artifacts
uses: actions/download-artifact@v5
with:
name: collection
path: .cache/collection-tarballs
- name: Install the collection tarball
run: >-
~/.local/bin/ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz
ansible-version: ${{ matrix.ansible-version }}
artifact-name: collection
artifact-path: .cache/collection-tarballs
- name: Run collection tests for connection
run: |
export PATH=~/.local/bin:$PATH
export ANSIBLE_CONFIG=$(pwd)/ci/ansible-dev.cfg
if [[ '${{ matrix.ansible-version }}' == 'ansible<2.10' ]]; then
export ANSIBLE_CONFIG=$(pwd)/ci/ansible-2.9.cfg
fi
echo $ANSIBLE_CONFIG
command -v ansible-playbook
@ -159,6 +125,14 @@ jobs:
ROOT= ./ci/run_connection_test.sh podman
ROOT=true ./ci/run_connection_test.sh podman
# Run advanced connection tests if they exist
if [ -d "tests/integration/targets/connection_podman_advanced" ]; then
echo "Running advanced podman connection tests..."
cd tests/integration/targets/connection_podman_advanced
ANSIBLECMD=~/.local/bin/ansible-playbook ./runme.sh || echo "Advanced tests skipped or failed"
cd -
fi
shell: bash
test-buildah-connection:
@ -182,65 +156,29 @@ jobs:
#- macos-latest
python-version:
#- 3.9
- "3.11"
- "3.12"
#- 3.6
#- 3.5
#- 2.7
include:
- os: ubuntu-22.04
ansible-version: git+https://github.com/ansible/ansible.git@devel
python-version: "3.12"
exclude:
- os: ubuntu-22.04
ansible-version: git+https://github.com/ansible/ansible.git@devel
python-version: "3.11"
steps:
- name: Check out repository
uses: actions/checkout@v5
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
- name: Setup Python/Ansible and install built collection
uses: ./.github/actions/setup-ansible-collection
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip and display Python and PIP versions
run: |
python -m pip install --upgrade pip
python -V
pip --version
- name: Set up pip cache
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ github.ref }}-units-VMs
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install Ansible ${{ matrix.ansible-version }}
run: python -m pip install --user '${{ matrix.ansible-version }}'
- name: Download migrated collection artifacts
uses: actions/download-artifact@v5
with:
name: collection
path: .cache/collection-tarballs
- name: Install the collection tarball
run: >-
~/.local/bin/ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz
ansible-version: ${{ matrix.ansible-version }}
artifact-name: collection
artifact-path: .cache/collection-tarballs
- name: Run collection tests for connection
run: |
export PATH=~/.local/bin:$PATH
export ANSIBLE_CONFIG=$(pwd)/ci/ansible-dev.cfg
if [[ '${{ matrix.ansible-version }}' == 'ansible<2.10' ]]; then
export ANSIBLE_CONFIG=$(pwd)/ci/ansible-2.9.cfg
fi
echo $ANSIBLE_CONFIG
command -v ansible-playbook
@ -254,6 +192,102 @@ jobs:
-e ansible_connection=local \
-e setup_python=false
- name: Run buildah connection tests
run: |
export PATH=~/.local/bin:$PATH
export ANSIBLE_CONFIG=$(pwd)/ci/ansible-dev.cfg
ROOT= ./ci/run_connection_test.sh buildah
ROOT=true ./ci/run_connection_test.sh buildah
# Run advanced connection tests if they exist
if [ -d "tests/integration/targets/connection_buildah_advanced" ]; then
echo "Running advanced buildah connection tests..."
cd tests/integration/targets/connection_buildah_advanced
ANSIBLECMD=~/.local/bin/ansible-playbook ./runme.sh || echo "Advanced tests skipped or failed"
cd -
fi
shell: bash
test-example-playbooks:
name: Test example playbooks with Podman and Buildah connection plugins
needs:
- build-collection-artifact-connection-tests
runs-on: ${{ matrix.os || 'ubuntu-22.04' }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
ansible-version:
- git+https://github.com/ansible/ansible.git@stable-2.18
- git+https://github.com/ansible/ansible.git@devel
os:
- ubuntu-24.04
#- ubuntu-22.04
#- ubuntu-16.04
#- macos-latest
python-version:
#- 3.9
- "3.12"
#- 3.6
#- 3.5
#- 2.7
steps:
- name: Check out repository
uses: actions/checkout@v5
- name: Setup Python/Ansible and install built collection
uses: ./.github/actions/setup-ansible-collection
with:
python-version: ${{ matrix.python-version }}
ansible-version: ${{ matrix.ansible-version }}
artifact-name: collection
artifact-path: .cache/collection-tarballs
- name: Run example Node build
working-directory: playbooks/examples
run: |
echo "Python: $(command -v python)"
echo "Python version: $(python --version)"
echo "Ansible: $(command -v ansible-playbook)"
echo "Ansible version: $(ansible --version)"
ansible-playbook -vvv -i localhost, -c local build_node_ai_api.yml -e image_name=ci-ai-node:latest
buildah images --format '{{.Name}}:{{.Tag}}' | grep -q 'ci-ai-node:latest$'
- name: Run example Go multistage build
working-directory: playbooks/examples
run: |
ansible-playbook -vv -i localhost, -c local build_go_ai_multistage.yml -e image_name=ci-ai-go:latest
buildah images --format '{{.Name}}:{{.Tag}}' | grep -q 'ci-ai-go:latest$'
- name: Run AI env build
working-directory: playbooks/examples
run: |
ansible-playbook -vv -i localhost, -c local build_ai_env_with_ansible.yml -e image_name=ci-ai-env:latest
buildah images --format '{{.Name}}:{{.Tag}}' | grep -q 'ci-ai-env:latest$'
- name: Run Podman example - exec basic
run: |
ansible-playbook -vv -i playbooks/examples/inventory/podman_all.yml playbooks/examples/podman_exec_basic.yml
- name: Run Podman example - copy and fetch
run: |
ansible-playbook -vv -i playbooks/examples/inventory/podman_all.yml playbooks/examples/podman_copy_fetch.yml
- name: Run Podman example - multiuser tasks
run: |
ansible-playbook -vv -i playbooks/examples/inventory/podman_all.yml playbooks/examples/podman_multiuser_tasks.yml
- name: Run Podman example - package manage
run: |
ansible-playbook -vv -i playbooks/examples/inventory/podman_all.yml playbooks/examples/podman_pkg_manage.yml
- name: Show resulting images
run: |
buildah images