mirror of
https://github.com/ansible-collections/community.routeros.git
synced 2025-08-17 00:01:04 +02:00
Rewrite EE test workflow to use ansible-builder 3.0.0 (#171)
* Rewrite EE test workflow to use ansible-builder 3.0.0. * Extend list of potential errors.
This commit is contained in:
parent
dd1e48c388
commit
4ec0945e55
2 changed files with 82 additions and 21 deletions
97
.github/workflows/ee.yml
vendored
97
.github/workflows/ee.yml
vendored
|
@ -22,14 +22,58 @@ env:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build and test EE (Ⓐ${{ matrix.runner_tag }})
|
name: Build and test EE (${{ matrix.name }})
|
||||||
strategy:
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
runner_tag:
|
name:
|
||||||
- devel
|
- ''
|
||||||
- stable-2.12-latest
|
ansible_core:
|
||||||
- stable-2.11-latest
|
- ''
|
||||||
- stable-2.9-latest
|
ansible_runner:
|
||||||
|
- ''
|
||||||
|
base_image:
|
||||||
|
- ''
|
||||||
|
pre_base:
|
||||||
|
- ''
|
||||||
|
extra_vars:
|
||||||
|
- ''
|
||||||
|
other_deps:
|
||||||
|
- ''
|
||||||
|
exclude:
|
||||||
|
- ansible_core: ''
|
||||||
|
include:
|
||||||
|
- name: ansible-core devel @ RHEL UBI 9
|
||||||
|
ansible_core: https://github.com/ansible/ansible/archive/devel.tar.gz
|
||||||
|
ansible_runner: ansible-runner
|
||||||
|
base_image: docker.io/redhat/ubi9:latest
|
||||||
|
pre_base: '"#"'
|
||||||
|
- name: ansible-core 2.15 @ Rocky Linux 9
|
||||||
|
ansible_core: https://github.com/ansible/ansible/archive/stable-2.15.tar.gz
|
||||||
|
ansible_runner: ansible-runner
|
||||||
|
base_image: quay.io/rockylinux/rockylinux:9
|
||||||
|
pre_base: '"#"'
|
||||||
|
- name: ansible-core 2.14 @ CentOS Stream 9
|
||||||
|
ansible_core: https://github.com/ansible/ansible/archive/stable-2.14.tar.gz
|
||||||
|
ansible_runner: ansible-runner
|
||||||
|
base_image: quay.io/centos/centos:stream9
|
||||||
|
pre_base: '"#"'
|
||||||
|
- name: ansible-core 2.13 @ RHEL UBI 8
|
||||||
|
ansible_core: https://github.com/ansible/ansible/archive/stable-2.13.tar.gz
|
||||||
|
ansible_runner: ansible-runner
|
||||||
|
other_deps: |2
|
||||||
|
python_interpreter:
|
||||||
|
package_system: python39 python39-pip python39-wheel python39-cryptography
|
||||||
|
base_image: docker.io/redhat/ubi8:latest
|
||||||
|
pre_base: '"#"'
|
||||||
|
- name: ansible-core 2.12 @ CentOS Stream 8
|
||||||
|
ansible_core: https://github.com/ansible/ansible/archive/stable-2.12.tar.gz
|
||||||
|
ansible_runner: ansible-runner
|
||||||
|
other_deps: |2
|
||||||
|
python_interpreter:
|
||||||
|
package_system: python39 python39-pip python39-wheel python39-cryptography
|
||||||
|
base_image: quay.io/centos/centos:stream8
|
||||||
|
pre_base: '"#"'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
|
@ -40,7 +84,7 @@ jobs:
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: '3.10'
|
python-version: '3.11'
|
||||||
|
|
||||||
- name: Install ansible-builder and ansible-navigator
|
- name: Install ansible-builder and ansible-navigator
|
||||||
run: pip install ansible-builder ansible-navigator
|
run: pip install ansible-builder ansible-navigator
|
||||||
|
@ -62,11 +106,6 @@ jobs:
|
||||||
'
|
'
|
||||||
working-directory: ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }}
|
working-directory: ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }}
|
||||||
|
|
||||||
- name: Install collection dependencies
|
|
||||||
run: git clone --depth=1 --single-branch https://github.com/ansible-collections/ansible.netcommon.git ansible_collections/ansible/netcommon
|
|
||||||
# NOTE: we're installing with git to work around Galaxy being a huge PITA (https://github.com/ansible/galaxy/issues/2429)
|
|
||||||
# run: ansible-galaxy collection install ansible.netcommon -p .
|
|
||||||
|
|
||||||
- name: Build collection
|
- name: Build collection
|
||||||
run: |
|
run: |
|
||||||
ansible-galaxy collection build --output-path ../../../
|
ansible-galaxy collection build --output-path ../../../
|
||||||
|
@ -79,11 +118,26 @@ jobs:
|
||||||
# EE config
|
# EE config
|
||||||
cat > execution-environment.yml <<EOF
|
cat > execution-environment.yml <<EOF
|
||||||
---
|
---
|
||||||
version: 1
|
version: 3
|
||||||
build_arg_defaults:
|
|
||||||
EE_BASE_IMAGE: 'quay.io/ansible/ansible-runner:${{ matrix.runner_tag }}'
|
|
||||||
dependencies:
|
dependencies:
|
||||||
|
ansible_core:
|
||||||
|
package_pip: ${{ matrix.ansible_core }}
|
||||||
|
ansible_runner:
|
||||||
|
package_pip: ${{ matrix.ansible_runner }}
|
||||||
galaxy: requirements.yml
|
galaxy: requirements.yml
|
||||||
|
${{ matrix.other_deps }}
|
||||||
|
|
||||||
|
images:
|
||||||
|
base_image:
|
||||||
|
name: ${{ matrix.base_image }}
|
||||||
|
|
||||||
|
additional_build_files:
|
||||||
|
- src: ${COLLECTION_FILENAME}
|
||||||
|
dest: src
|
||||||
|
|
||||||
|
additional_build_steps:
|
||||||
|
prepend_base:
|
||||||
|
- ${{ matrix.pre_base }}
|
||||||
EOF
|
EOF
|
||||||
echo "::group::execution-environment.yml"
|
echo "::group::execution-environment.yml"
|
||||||
cat execution-environment.yml
|
cat execution-environment.yml
|
||||||
|
@ -93,26 +147,29 @@ jobs:
|
||||||
cat > requirements.yml <<EOF
|
cat > requirements.yml <<EOF
|
||||||
---
|
---
|
||||||
collections:
|
collections:
|
||||||
- name: ${COLLECTION_FILENAME}
|
- name: src/${COLLECTION_FILENAME}
|
||||||
type: file
|
type: file
|
||||||
EOF
|
EOF
|
||||||
echo "::group::requirements.yml"
|
echo "::group::requirements.yml"
|
||||||
cat requirements.yml
|
cat requirements.yml
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
- name: Build image based on ${{ matrix.runner_tag }}
|
- name: Build image based on ${{ matrix.base_image }}
|
||||||
run: |
|
run: |
|
||||||
mkdir -p context/_build/
|
ansible-builder build --verbosity 3 --tag test-ee:latest --container-runtime docker
|
||||||
cp "${{ env.NAMESPACE }}-${{ env.COLLECTION_NAME }}"-*.tar.gz context/_build/
|
|
||||||
ansible-builder build -v 3 -t test-ee:latest --container-runtime=podman
|
- name: Show images
|
||||||
|
run: docker image ls
|
||||||
|
|
||||||
- name: Run basic tests
|
- name: Run basic tests
|
||||||
run: >
|
run: >
|
||||||
ansible-navigator run
|
ansible-navigator run
|
||||||
--mode stdout
|
--mode stdout
|
||||||
|
--container-engine docker
|
||||||
--pull-policy never
|
--pull-policy never
|
||||||
--set-environment-variable ANSIBLE_PRIVATE_ROLE_VARS=true
|
--set-environment-variable ANSIBLE_PRIVATE_ROLE_VARS=true
|
||||||
--execution-environment-image test-ee:latest
|
--execution-environment-image test-ee:latest
|
||||||
-v
|
-v
|
||||||
all.yml
|
all.yml
|
||||||
|
${{ matrix.extra_vars }}
|
||||||
working-directory: ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }}/tests/ee
|
working-directory: ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }}/tests/ee
|
||||||
|
|
|
@ -16,7 +16,11 @@
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- result is failed
|
- result is failed
|
||||||
- "'Error while connecting: [Errno 111] Connection refused' == result.msg"
|
- result.msg in potential_errors
|
||||||
|
vars:
|
||||||
|
potential_errors:
|
||||||
|
- "Error while connecting: [Errno 111] Connection refused"
|
||||||
|
- "Error while connecting: [Errno 99] Cannot assign requested address"
|
||||||
|
|
||||||
- name: Run command module
|
- name: Run command module
|
||||||
community.routeros.command:
|
community.routeros.command:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue