From 899545f4e98f39ac33612f6468bb65457756f5be Mon Sep 17 00:00:00 2001 From: Michal Arbet Date: Tue, 19 Sep 2023 16:35:40 +0200 Subject: [PATCH] [CI] Add podman build Change-Id: I41b89ec87a4849668102ca9c9cc79f0ef9944b85 --- .zuul.d/base.yaml | 1 + .zuul.d/debian.yaml | 11 ++++ .zuul.d/rocky.yaml | 11 ++++ .zuul.d/ubuntu.yaml | 11 ++++ tests/playbooks/post.yml | 18 ++++-- tests/playbooks/pre.yml | 123 ++++++++++++++++++++++++++++----------- tests/playbooks/run.yml | 1 + 7 files changed, 137 insertions(+), 39 deletions(-) diff --git a/.zuul.d/base.yaml b/.zuul.d/base.yaml index 662eba947d..028d3e20d8 100644 --- a/.zuul.d/base.yaml +++ b/.zuul.d/base.yaml @@ -140,6 +140,7 @@ - ^tox\.ini$ vars: publisher: false + container_engine: "docker" extra-vars: kolla_logs_dir: "{{ zuul_output_dir }}/logs/kolla" kolla_build_logs_dir: "{{ kolla_logs_dir }}/build" diff --git a/.zuul.d/debian.yaml b/.zuul.d/debian.yaml index 6c82b12472..5cc37d88b7 100644 --- a/.zuul.d/debian.yaml +++ b/.zuul.d/debian.yaml @@ -3,6 +3,7 @@ check: jobs: - kolla-build-debian + - kolla-build-debian-podman - kolla-ansible-debian: vars: kolla_python_version: "3.11" @@ -19,6 +20,7 @@ gate: jobs: - kolla-build-debian + - kolla-build-debian-podman - kolla-ansible-debian: vars: kolla_python_version: "3.11" @@ -47,6 +49,15 @@ base_distro: debian base_distro_version: bookworm +- job: + name: kolla-build-debian-podman + parent: kolla-base + nodeset: kolla-debian-bookworm + vars: + base_distro: debian + base_distro_version: bookworm + container_engine: podman + - job: name: kolla-build-debian-aarch64 parent: kolla-build-debian diff --git a/.zuul.d/rocky.yaml b/.zuul.d/rocky.yaml index d32e22b229..9afc2b199d 100644 --- a/.zuul.d/rocky.yaml +++ b/.zuul.d/rocky.yaml @@ -3,6 +3,7 @@ check: jobs: - kolla-build-rocky9 + - kolla-build-rocky9-podman - kolla-ansible-rocky9 - kolla-ansible-rocky9-upgrade # Test rabbitmq and mariadb in multinode ceph jobs. @@ -36,6 +37,7 @@ gate: jobs: - kolla-build-rocky9 + - kolla-build-rocky9-podman - kolla-ansible-rocky9 - kolla-ansible-rocky9-upgrade periodic: @@ -56,6 +58,15 @@ base_distro: rocky base_distro_version: 9 +- job: + name: kolla-build-rocky9-podman + parent: kolla-base + nodeset: kolla-rockylinux-9 + vars: + base_distro: rocky + base_distro_version: 9 + container_engine: podman + - job: name: kolla-build-rocky9-aarch64 parent: kolla-build-rocky9 diff --git a/.zuul.d/ubuntu.yaml b/.zuul.d/ubuntu.yaml index c267299819..3372960928 100644 --- a/.zuul.d/ubuntu.yaml +++ b/.zuul.d/ubuntu.yaml @@ -3,6 +3,7 @@ check: jobs: - kolla-build-ubuntu + - kolla-build-ubuntu-podman - kolla-ansible-ubuntu - kolla-ansible-ubuntu-upgrade # Test rabbitmq and mariadb in multinode ceph jobs. @@ -36,6 +37,7 @@ gate: jobs: - kolla-build-ubuntu + - kolla-build-ubuntu-podman - kolla-ansible-ubuntu - kolla-ansible-ubuntu-upgrade periodic: @@ -56,6 +58,15 @@ base_distro: ubuntu base_distro_version: jammy +- job: + name: kolla-build-ubuntu-podman + parent: kolla-base + nodeset: kolla-ubuntu-jammy + vars: + base_distro: ubuntu + base_distro_version: jammy + container_engine: podman + - job: name: kolla-build-ubuntu-aarch64 parent: kolla-build-ubuntu diff --git a/tests/playbooks/post.yml b/tests/playbooks/post.yml index a7bc9efac5..ddb96fa030 100644 --- a/tests/playbooks/post.yml +++ b/tests/playbooks/post.yml @@ -12,6 +12,8 @@ set +o errexit set -o xtrace + container_engine={{ container_engine }} + # copy system log sudo cp -r /var/log system_log @@ -19,16 +21,22 @@ # the journal gives us syslog() and kernel output, so is like # a concatenation of the above. sudo journalctl --no-pager > syslog.txt - sudo journalctl --no-pager -u docker.service > docker.log + sudo journalctl --no-pager -u {{ container_engine }}.service > {{ container_engine }}.log else # assume rsyslog sudo cp /var/log/syslog syslog.txt sudo cp /var/log/kern.log kern_log.txt - sudo cp /var/log/upstart/docker.log docker.log + sudo cp /var/log/upstart/{{ container_engine }}.log {{ container_engine }}.log fi - if sudo test -d /var/lib/docker/volumes/kolla_logs/_data; then - sudo cp -r /var/lib/docker/volumes/kolla_logs/_data kolla_logs + if [ "${container_engine}" == "docker" ]; then + if sudo test -d /var/lib/docker/volumes/kolla_logs/_data; then + sudo cp -r /var/lib/docker/volumes/kolla_logs/_data kolla_logs + fi + else + if sudo test -d /var/lib/containers/storage/volumes/kolla_logs/_data; then + sudo cp -r /var/lib/containers/storage/volumes/kolla_logs/_data kolla_logs + fi fi # sudo config @@ -52,7 +60,7 @@ ps -eo user,pid,ppid,lwp,%cpu,%mem,size,rss,cmd > ps.txt # docker related information - (docker info && docker system df && docker system df -v) > docker-info.txt + ({{ container_engine }} info && {{ container_engine }} system df && {{ container_engine }} system df -v) > {{ container_engine }}-info.txt sudo cp -r /etc/kolla kolla_configs diff --git a/tests/playbooks/pre.yml b/tests/playbooks/pre.yml index 5e4b525f28..c8b2b0a589 100644 --- a/tests/playbooks/pre.yml +++ b/tests/playbooks/pre.yml @@ -110,6 +110,10 @@ - name: Install kolla command: "{{ virtualenv_path }}/bin/python -m pip install {{ zuul.project.src_dir }}" + - name: Install podman python library + command: "{{ virtualenv_path }}/bin/python -m pip install podman" + when: container_engine == "podman" + - name: Configure Docker repo for Debian/Ubuntu block: - name: Add key for Docker APT repository @@ -127,7 +131,9 @@ name: apparmor state: present - when: ansible_os_family == "Debian" + when: + - ansible_os_family == "Debian" + - container_engine == "docker" become: true - name: Configure Docker repo for CentOS @@ -146,42 +152,91 @@ lineinfile: path: /etc/yum.repos.d/docker.repo line: 'module_hotfixes=True' - when: ansible_os_family == "RedHat" + when: + - ansible_os_family == "RedHat" + - container_engine == "docker" become: true - - name: Ensure /etc/docker exists - become: true - file: - path: /etc/docker - state: directory - mode: 0755 + - name: Configure docker + block: + - name: Ensure /etc/docker exists + become: true + file: + path: /etc/docker + state: directory + mode: 0755 - - name: Configure registry-mirror in daemon.json - become: true - copy: - dest: /etc/docker/daemon.json - content: | - { - "registry-mirrors": [ - "http://{{ zuul_site_mirror_fqdn }}:8082/" - ] - } + - name: Configure registry-mirror in daemon.json + become: true + copy: + dest: /etc/docker/daemon.json + content: | + { + "registry-mirrors": [ + "http://{{ zuul_site_mirror_fqdn }}:8082/" + ] + } - # NOTE(yoctozepto): We configure Docker before installing it because Debuntu starts services - # during installation. - - name: Install Docker - package: - name: docker-ce - become: true + # NOTE(yoctozepto): We configure Docker before installing it because Debuntu starts services + # during installation. + - name: Install Docker + package: + name: docker-ce + become: true - - name: Ensure Docker service is started - service: - name: docker - state: started - become: true + - name: Ensure Docker service is started + service: + name: docker + state: started + become: true - - name: Ensure Docker socket is world-writable - file: - path: /run/docker.sock - mode: 0666 - become: true + - name: Ensure Docker socket is world-writable + file: + path: /run/docker.sock + mode: 0666 + become: true + when: + - container_engine == "docker" + + - name: Configure podman + block: + - name: Ensure /etc/containers exists + become: true + file: + path: /etc/containers + state: directory + mode: 0755 + + - name: Configure registries.conf + become: true + copy: + dest: /etc/containers/registries.conf + content: | + unqualified-search-registries = ['docker.io'] + + [[registry]] + prefix = "docker.io" + location = "docker.io" + + [[registry.mirror]] + prefix = "docker.io" + location = "{{ zuul_site_mirror_fqdn }}:8082" + + - name: Install Podman + package: + name: podman + become: true + + - name: Ensure Podman service is started + service: + name: podman + state: started + become: true + + - name: Ensure Podman socket is world-writable + file: + path: /run/podman/podman.sock + mode: 0666 + become: true + when: + - container_engine == "podman" diff --git a/tests/playbooks/run.yml b/tests/playbooks/run.yml index 7e0b486956..e21c19f217 100644 --- a/tests/playbooks/run.yml +++ b/tests/playbooks/run.yml @@ -10,6 +10,7 @@ logs_dir: "{{ kolla_build_logs_dir }}" quiet: true base: "{{ base_distro }}" + engine: "{{ container_engine }}" template_override: /etc/kolla/template_overrides.j2 # NOTE(yoctozepto): to avoid issues with IPv6 not enabled in the docker daemon # and since we don't need isolated networks here, use host networking