[CI] Add podman build

Change-Id: I41b89ec87a4849668102ca9c9cc79f0ef9944b85
This commit is contained in:
Michal Arbet 2023-09-19 16:35:40 +02:00
parent b76bd4c6ef
commit 899545f4e9
7 changed files with 137 additions and 39 deletions

View File

@ -140,6 +140,7 @@
- ^tox\.ini$ - ^tox\.ini$
vars: vars:
publisher: false publisher: false
container_engine: "docker"
extra-vars: extra-vars:
kolla_logs_dir: "{{ zuul_output_dir }}/logs/kolla" kolla_logs_dir: "{{ zuul_output_dir }}/logs/kolla"
kolla_build_logs_dir: "{{ kolla_logs_dir }}/build" kolla_build_logs_dir: "{{ kolla_logs_dir }}/build"

View File

@ -3,6 +3,7 @@
check: check:
jobs: jobs:
- kolla-build-debian - kolla-build-debian
- kolla-build-debian-podman
- kolla-ansible-debian: - kolla-ansible-debian:
vars: vars:
kolla_python_version: "3.11" kolla_python_version: "3.11"
@ -19,6 +20,7 @@
gate: gate:
jobs: jobs:
- kolla-build-debian - kolla-build-debian
- kolla-build-debian-podman
- kolla-ansible-debian: - kolla-ansible-debian:
vars: vars:
kolla_python_version: "3.11" kolla_python_version: "3.11"
@ -47,6 +49,15 @@
base_distro: debian base_distro: debian
base_distro_version: bookworm 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: - job:
name: kolla-build-debian-aarch64 name: kolla-build-debian-aarch64
parent: kolla-build-debian parent: kolla-build-debian

View File

@ -3,6 +3,7 @@
check: check:
jobs: jobs:
- kolla-build-rocky9 - kolla-build-rocky9
- kolla-build-rocky9-podman
- kolla-ansible-rocky9 - kolla-ansible-rocky9
- kolla-ansible-rocky9-upgrade - kolla-ansible-rocky9-upgrade
# Test rabbitmq and mariadb in multinode ceph jobs. # Test rabbitmq and mariadb in multinode ceph jobs.
@ -36,6 +37,7 @@
gate: gate:
jobs: jobs:
- kolla-build-rocky9 - kolla-build-rocky9
- kolla-build-rocky9-podman
- kolla-ansible-rocky9 - kolla-ansible-rocky9
- kolla-ansible-rocky9-upgrade - kolla-ansible-rocky9-upgrade
periodic: periodic:
@ -56,6 +58,15 @@
base_distro: rocky base_distro: rocky
base_distro_version: 9 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: - job:
name: kolla-build-rocky9-aarch64 name: kolla-build-rocky9-aarch64
parent: kolla-build-rocky9 parent: kolla-build-rocky9

View File

@ -3,6 +3,7 @@
check: check:
jobs: jobs:
- kolla-build-ubuntu - kolla-build-ubuntu
- kolla-build-ubuntu-podman
- kolla-ansible-ubuntu - kolla-ansible-ubuntu
- kolla-ansible-ubuntu-upgrade - kolla-ansible-ubuntu-upgrade
# Test rabbitmq and mariadb in multinode ceph jobs. # Test rabbitmq and mariadb in multinode ceph jobs.
@ -36,6 +37,7 @@
gate: gate:
jobs: jobs:
- kolla-build-ubuntu - kolla-build-ubuntu
- kolla-build-ubuntu-podman
- kolla-ansible-ubuntu - kolla-ansible-ubuntu
- kolla-ansible-ubuntu-upgrade - kolla-ansible-ubuntu-upgrade
periodic: periodic:
@ -56,6 +58,15 @@
base_distro: ubuntu base_distro: ubuntu
base_distro_version: jammy 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: - job:
name: kolla-build-ubuntu-aarch64 name: kolla-build-ubuntu-aarch64
parent: kolla-build-ubuntu parent: kolla-build-ubuntu

View File

@ -12,6 +12,8 @@
set +o errexit set +o errexit
set -o xtrace set -o xtrace
container_engine={{ container_engine }}
# copy system log # copy system log
sudo cp -r /var/log system_log sudo cp -r /var/log system_log
@ -19,16 +21,22 @@
# the journal gives us syslog() and kernel output, so is like # the journal gives us syslog() and kernel output, so is like
# a concatenation of the above. # a concatenation of the above.
sudo journalctl --no-pager > syslog.txt 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 else
# assume rsyslog # assume rsyslog
sudo cp /var/log/syslog syslog.txt sudo cp /var/log/syslog syslog.txt
sudo cp /var/log/kern.log kern_log.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 fi
if sudo test -d /var/lib/docker/volumes/kolla_logs/_data; then if [ "${container_engine}" == "docker" ]; then
sudo cp -r /var/lib/docker/volumes/kolla_logs/_data kolla_logs 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 fi
# sudo config # sudo config
@ -52,7 +60,7 @@
ps -eo user,pid,ppid,lwp,%cpu,%mem,size,rss,cmd > ps.txt ps -eo user,pid,ppid,lwp,%cpu,%mem,size,rss,cmd > ps.txt
# docker related information # 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 sudo cp -r /etc/kolla kolla_configs

View File

@ -110,6 +110,10 @@
- name: Install kolla - name: Install kolla
command: "{{ virtualenv_path }}/bin/python -m pip install {{ zuul.project.src_dir }}" 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 - name: Configure Docker repo for Debian/Ubuntu
block: block:
- name: Add key for Docker APT repository - name: Add key for Docker APT repository
@ -127,7 +131,9 @@
name: apparmor name: apparmor
state: present state: present
when: ansible_os_family == "Debian" when:
- ansible_os_family == "Debian"
- container_engine == "docker"
become: true become: true
- name: Configure Docker repo for CentOS - name: Configure Docker repo for CentOS
@ -146,42 +152,91 @@
lineinfile: lineinfile:
path: /etc/yum.repos.d/docker.repo path: /etc/yum.repos.d/docker.repo
line: 'module_hotfixes=True' line: 'module_hotfixes=True'
when: ansible_os_family == "RedHat" when:
- ansible_os_family == "RedHat"
- container_engine == "docker"
become: true become: true
- name: Ensure /etc/docker exists - name: Configure docker
become: true block:
file: - name: Ensure /etc/docker exists
path: /etc/docker become: true
state: directory file:
mode: 0755 path: /etc/docker
state: directory
mode: 0755
- name: Configure registry-mirror in daemon.json - name: Configure registry-mirror in daemon.json
become: true become: true
copy: copy:
dest: /etc/docker/daemon.json dest: /etc/docker/daemon.json
content: | content: |
{ {
"registry-mirrors": [ "registry-mirrors": [
"http://{{ zuul_site_mirror_fqdn }}:8082/" "http://{{ zuul_site_mirror_fqdn }}:8082/"
] ]
} }
# NOTE(yoctozepto): We configure Docker before installing it because Debuntu starts services # NOTE(yoctozepto): We configure Docker before installing it because Debuntu starts services
# during installation. # during installation.
- name: Install Docker - name: Install Docker
package: package:
name: docker-ce name: docker-ce
become: true become: true
- name: Ensure Docker service is started - name: Ensure Docker service is started
service: service:
name: docker name: docker
state: started state: started
become: true become: true
- name: Ensure Docker socket is world-writable - name: Ensure Docker socket is world-writable
file: file:
path: /run/docker.sock path: /run/docker.sock
mode: 0666 mode: 0666
become: true 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"

View File

@ -10,6 +10,7 @@
logs_dir: "{{ kolla_build_logs_dir }}" logs_dir: "{{ kolla_build_logs_dir }}"
quiet: true quiet: true
base: "{{ base_distro }}" base: "{{ base_distro }}"
engine: "{{ container_engine }}"
template_override: /etc/kolla/template_overrides.j2 template_override: /etc/kolla/template_overrides.j2
# NOTE(yoctozepto): to avoid issues with IPv6 not enabled in the docker daemon # 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 # and since we don't need isolated networks here, use host networking