diff --git a/tests/azure/build-containers.yml b/tests/azure/build-containers.yml index 0423dfd9c4..75c3853909 100644 --- a/tests/azure/build-containers.yml +++ b/tests/azure/build-containers.yml @@ -11,18 +11,19 @@ schedules: trigger: none pool: - vmImage: 'ubuntu-20.04' + vmImage: 'ubuntu-22.04' stages: -- stage: CentOS_7 - dependsOn: [] - jobs: - - template: templates/build_container.yml - parameters: - job_name_suffix: Centos7 - container_name: centos-7 - build_scenario_name: centos-7-build +# Currently, it's not possible to use CentOS container +# +# - stage: CentOS_7 +# dependsOn: [] +# jobs: +# - template: templates/build_container.yml +# parameters: +# job_name_suffix: Centos7 +# distro: centos-7 - stage: CentOS_8_Stream dependsOn: [] @@ -30,8 +31,9 @@ stages: - template: templates/build_container.yml parameters: job_name_suffix: C8S - container_name: c8s - build_scenario_name: c8s-build + distro: c8s + # ansible-core 2.17+ cannot be used to deploy on CentOS 8 Stream. + ansible_core_version: "<2.17" - stage: CentOS_9_Stream dependsOn: [] @@ -39,8 +41,7 @@ stages: - template: templates/build_container.yml parameters: job_name_suffix: C9S - container_name: c9s - build_scenario_name: c9s-build + distro: c9s - stage: Fedora_Latest dependsOn: [] @@ -48,8 +49,7 @@ stages: - template: templates/build_container.yml parameters: job_name_suffix: FedoraLatest - container_name: fedora-latest - build_scenario_name: fedora-latest-build + distro: fedora-latest - stage: Fedora_Rawhide dependsOn: [] @@ -57,5 +57,4 @@ stages: - template: templates/build_container.yml parameters: job_name_suffix: FedoraRawhide - container_name: fedora-rawhide - build_scenario_name: fedora-rawhide-build + distro: fedora-rawhide diff --git a/tests/azure/templates/build_container.yml b/tests/azure/templates/build_container.yml index 18c1bd8a9f..1bef170ade 100644 --- a/tests/azure/templates/build_container.yml +++ b/tests/azure/templates/build_container.yml @@ -2,38 +2,54 @@ parameters: - name: job_name_suffix type: string - - name: container_name - type: string - - name: build_scenario_name + - name: distro type: string - name: python_version type: string default: 3.x + - name: ansible_core_version + default: "" jobs: - job: BuildTestImage${{ parameters.job_name_suffix }} - displayName: Build ${{ parameters.container_name }} test container + displayName: Build ${{ parameters.distro }} test container steps: - task: UsePythonVersion@0 inputs: versionSpec: '${{ parameters.python_version }}' - - script: python -m pip install --upgrade pip setuptools wheel ansible + - script: python -m pip install --upgrade pip "ansible-core${{ parameters.ansible_core_version }}" retryCountOnTaskFailure: 5 displayName: Install tools + - script: | + rm -rf ~/.ansible + mkdir -p ~/.ansible + ln -snf $(readlink -f roles) ~/.ansible/roles + ln -snf $(readlink -f plugins) ~/.ansible/plugins + displayName: Setup ansible-freeipa using Git repository + - script: ansible-galaxy collection install containers.podman - retryCountOnTaskFailure: 5 - displayName: Install Ansible collections + displayName: Install Ansible Galaxy collections - - script: infra/image/build.sh ${{ parameters.build_scenario_name }} - retryCountOnTaskFailure: 5 - displayName: Create test container + - script: infra/image/build.sh -I ${{ parameters.distro }} + displayName: Build ${{ parameters.distro }} base image - - script: | - podman login -u="$QUAY_ROBOT_USERNAME" -p="$QUAY_ROBOT_TOKEN" quay.io - podman push quay.io/ansible-freeipa/upstream-tests:${{ parameters.container_name }} - displayName: Save image and upload + - script: podman login -u="$QUAY_ROBOT_USERNAME" -p="$QUAY_ROBOT_TOKEN" quay.io + displayName: Registry login env: # Secrets needs to be mapped as env vars to work properly QUAY_ROBOT_TOKEN: $(QUAY_ROBOT_TOKEN) + + - script: | + commited="$(podman commit ansible-test)" + podman push "${commited}" quay.io/ansible-freeipa/upstream-tests:${{ parameters.distro }}-base + displayName: Save base image and upload + + - script: infra/image/build.sh -c ansible-test ${{ parameters.distro }} + displayName: Install FreeIPA into the container + + - script: | + commited="$(podman commit ansible-test)" + podman push "${commited}" quay.io/ansible-freeipa/upstream-tests:${{ parameters.distro }} + displayName: Save FreeIPA image and upload