[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$
vars:
publisher: false
container_engine: "docker"
extra-vars:
kolla_logs_dir: "{{ zuul_output_dir }}/logs/kolla"
kolla_build_logs_dir: "{{ kolla_logs_dir }}/build"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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