Skip to content

Commit

Permalink
Replace some script templating expressions with environment variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed Dec 14, 2024
1 parent c05fe65 commit 515080b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 11 deletions.
31 changes: 22 additions & 9 deletions .github/workflows/ansible-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,18 @@ jobs:
python-version: "3.12"

- name: Install dependencies
env:
ANSIBLE_CORE_1: ${{ matrix.ansible-core-1 }}
run: |
sudo apt-get install podman buildah
pip install ${{ matrix.ansible-core-1 }}
pip install "${ANSIBLE_CORE_1}"
- name: Build ${{ matrix.name }} image
env:
NAME: ${{ matrix.name }}
run: |
${{ matrix.name }}/build.sh
podman tag localhost/test-image:${{ matrix.name }} "${CONTAINER_REGISTRY}/${CONTAINER_IMAGE_NAME}:${{ matrix.name }}"
"${NAME}/build.sh"
podman tag "localhost/test-image:${NAME}" "${CONTAINER_REGISTRY}/${CONTAINER_IMAGE_NAME}:${NAME}"
working-directory: ./ansible-test/

# This is necessary to allow running systemd in rootless containers
Expand All @@ -81,28 +85,37 @@ jobs:
- name: Run basic tests with ${{ matrix.name }} image (${{ matrix.ansible-core-1 }}, Python versions ${{ matrix.python }}, Podman)
if: ${{ matrix.test-with-podman }}
env:
NAME: ${{ matrix.name }}
PYTHON_VERSIONS: ${{ matrix.python }}
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/
for PYTHON in ${PYTHON_VERSIONS}; do
ansible-test integration --color -v --python "${PYTHON}" --docker "localhost/test-image:${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 }}
env:
NAME: ${{ matrix.name }}
run: |
podman push localhost/test-image:${{ matrix.name }} docker-daemon:localhost/test-image:${{ matrix.name }}
podman push "localhost/test-image:${NAME}" "docker-daemon:localhost/test-image:${NAME}"
- name: Install ansible-core ${{ matrix.ansible-core-2 }}
if: ${{ matrix.test-with-docker }}
env:
ANSIBLE_CORE_2: ${{ matrix.ansible-core-2 }}
run: |
pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible-core-2 }}.tar.gz
pip install "https://github.com/ansible/ansible/archive/${ANSIBLE_CORE_@}.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 }}
env:
NAME: ${{ matrix.name }}
PYTHON_VERSIONS: ${{ matrix.python }}
run: |
for PYTHON in ${{ matrix.python }}; do
ansible-test integration --color -v --python ${PYTHON} --docker localhost/test-image:${{ matrix.name }} shippable/posix/group1/
for PYTHON in ${PYTHON_VERSIONS}; do
ansible-test integration --color -v --python "${PYTHON}" --docker "localhost/test-image:${NAME}" shippable/posix/group1/
done
working-directory: ./.github/ansible-test-tests/ansible_collections/testns/testcol

Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/execution-environments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,17 @@ jobs:
pip install ansible-core ansible-builder ansible-navigator
- name: Build ${{ matrix.name }} image
env:
NAME: ${{ matrix.name }}
run: |
ansible-builder build -v 3 -t test-ee:${{ matrix.name }}
ansible-builder build -v 3 -t "test-ee:${NAME}"
working-directory: ./execution-environments/${{ matrix.name }}

- name: Run basic tests with ${{ matrix.name }} image
env:
NAME: ${{ matrix.name }}
run: |
ansible-navigator -v --mode stdout --pull-policy never \
--execution-environment-image test-ee:${{ matrix.name }} \
--execution-environment-image "test-ee:${NAME}" \
run tests.yml
working-directory: ./execution-environments/${{ matrix.name }}

0 comments on commit 515080b

Please sign in to comment.