Skip to content

Commit

Permalink
upstream ci: Remove dependency on molecule
Browse files Browse the repository at this point in the history
We only use molecule to build images and start testing containers, which
adds unneeded complexity by increasing the software stack in a way that
does not bring any advantage.

There's also risk that changes on molecule break the tests, which has
happened a few times.

This change removes the dependency on molecule by using docker/podman
directly to build and run the test containers.
  • Loading branch information
rjeffman committed Jun 22, 2024
1 parent a1230ca commit 1faf5a0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion tests/azure/pr-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ trigger:
- master

pool:
vmImage: 'ubuntu-20.04'
vmImage: 'ubuntu-22.04'

stages:

Expand Down
21 changes: 13 additions & 8 deletions tests/azure/templates/playbook_fast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,32 +31,37 @@ jobs:
versionSpec: '${{ parameters.python_version }}'

- script: |
pip install \
"molecule-plugins[docker]" \
"requests<2.29" \
"ansible${{ parameters.ansible_version }}"
pip install "ansible${{ parameters.ansible_version }}"
retryCountOnTaskFailure: 5
displayName: Install molecule and Ansible
displayName: Install Ansible
- script: ansible-galaxy collection install community.docker ansible.posix
retryCountOnTaskFailure: 5
displayName: Install Ansible collections

- script: pip install -r requirements-tests.txt
retryCountOnTaskFailure: 5
displayName: Install dependencies
displayName: Install test dependencies

- script: |
rm -rf ~/ansible
mkdir -p ~/.ansible/roles ~/.ansible/library ~/.ansible/module_utils
cp -a roles/* ~/.ansible/roles
cp -a plugins/modules/* ~/.ansible/library
cp -a plugins/module_utils/* ~/.ansible/module_utils
molecule create -s ${{ parameters.scenario }}
docker pull -q quay.io/ansible-freeipa/upstream-tests:${{ parameters.scenario }}
docker create \
--hostname ${HOSTNAME} \
--memory 3g \
--memory-swap -1 \
--add-host ${HOSTNAME}:127.0.0.1 \
--name ${{ parameters.scenario }} \
quay.io/ansible-freeipa/upstream-tests:${{ parameters.scenario }}
docker start ${{ parameters.scenario }}
retryCountOnTaskFailure: 5
displayName: Setup test container
env:
ANSIBLE_LIBRARY: ./molecule
HOSTNAME: "ipaserver.test.local"
- script: |
. utils/set_test_modules
Expand Down
6 changes: 2 additions & 4 deletions tests/azure/templates/playbook_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,17 @@ jobs:

- script: |
pip install \
"molecule-plugins[docker]" \
"requests<2.29" \
"ansible${{ parameters.ansible_version }}"
retryCountOnTaskFailure: 5
displayName: Install molecule and Ansible
displayName: Install Ansible
- script: ansible-galaxy collection install community.docker ansible.posix
retryCountOnTaskFailure: 5
displayName: Install Ansible collections

- script: pip install -r requirements-tests.txt
retryCountOnTaskFailure: 5
displayName: Install dependencies
displayName: Install test dependencies

- script: |
rm -rf ~/ansible
Expand Down

0 comments on commit 1faf5a0

Please sign in to comment.