From b4c696504f7a14d6677ce9faa8f2c56328da1ff8 Mon Sep 17 00:00:00 2001 From: Rafael Guterres Jeffman Date: Wed, 26 Jun 2024 14:55:53 +0000 Subject: [PATCH] upstream ci: Use util scripts instead of molecule This patch start the removal of the dependency on molecule for tests, by using the scripts under `utils` to setup the environment. By not using molecule, we have more flexibility on using either docker or podman as the container engine, and makes it easy to reproduce the environment on different distros, allowing for a more consistent error reproduction off Azure. --- tests/azure/pr-pipeline.yml | 2 +- tests/azure/templates/playbook_fast.yml | 30 ++++++++++++------------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/tests/azure/pr-pipeline.yml b/tests/azure/pr-pipeline.yml index 2345347db4..842ba2b167 100644 --- a/tests/azure/pr-pipeline.yml +++ b/tests/azure/pr-pipeline.yml @@ -3,7 +3,7 @@ trigger: - master pool: - vmImage: 'ubuntu-20.04' + vmImage: 'ubuntu-22.04' stages: diff --git a/tests/azure/templates/playbook_fast.yml b/tests/azure/templates/playbook_fast.yml index a01d2c348f..476388386d 100644 --- a/tests/azure/templates/playbook_fast.yml +++ b/tests/azure/templates/playbook_fast.yml @@ -31,14 +31,20 @@ 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 + - 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 + retryCountOnTaskFailure: 5 + displayName: Setup controller environment + + - script: ansible-galaxy collection install containers.podman ansible.posix retryCountOnTaskFailure: 5 displayName: Install Ansible collections @@ -47,16 +53,8 @@ jobs: displayName: Install 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 }} - retryCountOnTaskFailure: 5 + utils/setup_test_container.sh -e podman -i ${{ parameters.scenario }} ${{ parameters.scenario }} displayName: Setup test container - env: - ANSIBLE_LIBRARY: ./molecule - script: | . utils/set_test_modules @@ -80,7 +78,7 @@ jobs: displayName: Run playbook tests env: IPA_SERVER_HOST: ${{ parameters.scenario }} - RUN_TESTS_IN_DOCKER: true + RUN_TESTS_IN_DOCKER: podman IPA_DISABLED_MODULES: ${{ variables.ipa_disabled_modules }} IPA_DISABLED_TESTS: ${{ variables.ipa_disabled_tests }} IPA_VERBOSITY: "-vvv"