From 73af4896b4994f68cd0c4d192ac148d09e4b0c9b Mon Sep 17 00:00:00 2001 From: Sergey <6213510+sshnaidm@users.noreply.github.com> Date: Mon, 28 Nov 2022 19:49:27 -0500 Subject: [PATCH] Prepare CI for Podman v3 backward compatibility (#528) Signed-off-by: Sagi Shnaidman Signed-off-by: Sagi Shnaidman --- .github/workflows/podman_container.yml | 97 +++---------------------- .github/workflows/podman_containers.yml | 3 +- .github/workflows/podman_secret.yml | 2 +- ci/playbooks/install_repos.yml | 15 +++- 4 files changed, 27 insertions(+), 90 deletions(-) diff --git a/.github/workflows/podman_container.yml b/.github/workflows/podman_container.yml index 4e0ca4b..ed2276a 100644 --- a/.github/workflows/podman_container.yml +++ b/.github/workflows/podman_container.yml @@ -31,7 +31,7 @@ on: jobs: test_podman_container: - name: Podman container ${{ matrix.ansible-version }}-${{ matrix.os || 'ubuntu-22.04' }} + name: Podman container ${{ matrix.ansible-version }}-${{ matrix.os || 'ubuntu-22.04' }}-${{ matrix.podman-version || 'unstable' }} runs-on: ${{ matrix.os || 'ubuntu-22.04' }} defaults: run: @@ -41,13 +41,19 @@ jobs: matrix: ansible-version: - ansible<2.10 - - git+https://github.com/ansible/ansible.git@stable-2.12 - - git+https://github.com/ansible/ansible.git@stable-2.13 + - git+https://github.com/ansible/ansible.git@stable-2.14 - git+https://github.com/ansible/ansible.git@devel os: - ubuntu-22.04 python-version: - 3.9 + podman-version: + - unstable + include: + - os: ubuntu-22.04 + ansible-version: git+https://github.com/ansible/ansible.git@stable-2.14 + python-version: 3.9 + podman-version: stable steps: @@ -109,89 +115,8 @@ jobs: -e host=localhost \ -i localhost, \ -e ansible_connection=local \ - -e setup_python=false - - TEST2RUN=podman_container ./ci/run_containers_tests.sh - shell: bash - - test_podman_container_with_pip: - name: Podman container w/ pip ${{ matrix.ansible-version }}-${{ matrix.os || 'ubuntu-22.04' }} - runs-on: ${{ matrix.os || 'ubuntu-22.04' }} - defaults: - run: - shell: bash - strategy: - fail-fast: false - matrix: - ansible-version: - - ansible<2.10 - #- git+https://github.com/ansible/ansible.git@stable-2.10 - os: - - ubuntu-22.04 - python-version: - - 3.9 - - steps: - - - name: Check out repository - uses: actions/checkout@v3 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - - name: Upgrade pip and display Python and PIP versions - run: | - sudo apt-get update - sudo apt-get install -y python*-wheel python*-yaml - python -m pip install --upgrade pip - python -V - pip --version - - - name: Set up pip cache - uses: actions/cache@v3 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ github.ref }}-units-VMs - restore-keys: | - ${{ runner.os }}-pip- - ${{ runner.os }}- - - - name: Install Ansible ${{ matrix.ansible-version }} - run: python3 -m pip install --user --force-reinstall --upgrade '${{ matrix.ansible-version }}' - - - name: Build and install the collection tarball - run: | - export PATH=~/.local/bin:$PATH - - echo "Run ansible version" - command -v ansible - ansible --version - python3 -m pip install --user --force-reinstall --upgrade . - - - - name: Run collection tests for podman container - run: | - export PATH=~/.local/bin:$PATH - export ANSIBLE_COLLECTIONS_PATHS=~/.local/share/ansible/collections - - export ANSIBLE_CONFIG=$(pwd)/ci/ansible-dev.cfg - if [[ '${{ matrix.ansible-version }}' == 'ansible<2.10' ]]; then - export ANSIBLE_CONFIG=$(pwd)/ci/ansible-2.9.cfg - fi - - echo $ANSIBLE_CONFIG - command -v ansible-playbook - pip --version - python --version - ansible-playbook --version - - ansible-playbook -vv ci/playbooks/pre.yml \ - -e host=localhost \ - -i localhost, \ - -e ansible_connection=local \ - -e setup_python=false + -e setup_python=false \ + -e podman_version_ubuntu=${{ matrix.podman-version }} TEST2RUN=podman_container ./ci/run_containers_tests.sh shell: bash diff --git a/.github/workflows/podman_containers.yml b/.github/workflows/podman_containers.yml index f7b524d..6cfc056 100644 --- a/.github/workflows/podman_containers.yml +++ b/.github/workflows/podman_containers.yml @@ -41,8 +41,7 @@ jobs: matrix: ansible-version: - ansible<2.10 - - git+https://github.com/ansible/ansible.git@stable-2.12 - - git+https://github.com/ansible/ansible.git@stable-2.13 + - git+https://github.com/ansible/ansible.git@stable-2.14 - git+https://github.com/ansible/ansible.git@devel os: - ubuntu-22.04 diff --git a/.github/workflows/podman_secret.yml b/.github/workflows/podman_secret.yml index b454727..a9783e0 100644 --- a/.github/workflows/podman_secret.yml +++ b/.github/workflows/podman_secret.yml @@ -37,7 +37,7 @@ jobs: matrix: ansible-version: - ansible<2.10 - - git+https://github.com/ansible/ansible.git@stable-2.12 + - git+https://github.com/ansible/ansible.git@stable-2.14 - git+https://github.com/ansible/ansible.git@devel os: - ubuntu-22.04 diff --git a/ci/playbooks/install_repos.yml b/ci/playbooks/install_repos.yml index 7b7ffcd..b264770 100644 --- a/ci/playbooks/install_repos.yml +++ b/ci/playbooks/install_repos.yml @@ -4,6 +4,19 @@ shell: | . /etc/os-release echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${VERSION_ID}/ /" > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list + curl -L https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${VERSION_ID}/Release.key | apt-key add - + apt-get update + when: + - ansible_distribution|lower == "ubuntu" + - podman_version_ubuntu | default('unstable') == 'unstable' + +- name: Install repo for ubuntu + become: true + shell: | + . /etc/os-release + echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /" > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list curl -L https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/Release.key | apt-key add - apt-get update - when: ansible_distribution|lower == "ubuntu" + when: + - ansible_distribution|lower == "ubuntu" + - podman_version_ubuntu | default('unstable') == 'stable'