container-images: incorporate, test and publish centos8

This leverages the contribution from Fabian [1] for building an image
based on CentOS8.
The image will be built and tested for every new patch with Zuul and
it'll be pushed to DockerHub [2] after every merge.

The tag nomenclature had to be changed in order to fit the distribution
as an attribute, before:
- latest (tagged from source-latest)
- pypi-latest
- distribution-latest
- source-latest

to:
- latest (tagged from fedora32-source-latest)
- fedora32-source-latest
- fedora32-distribution-latest
- fedora32-pypi-latest
- centos8-pypi-latest

[1]: 8491cc5a72
[2]: https://hub.docker.com/r/recordsansible/ara-api

Change-Id: I971abd97039a28e825b6b7cd43a7559abe709f30
This commit is contained in:
David Moreau Simard 2020-07-23 19:59:47 -04:00
parent 7fa7e80566
commit 560f8c5d2f
No known key found for this signature in database
GPG Key ID: 7D4729EC4E64E8B7
7 changed files with 28 additions and 17 deletions

View File

@ -25,12 +25,17 @@ Building an image with buildah
You will need to install `buildah <https://github.com/containers/buildah/blob/master/install.md>`_.
The different scripts to build container images are available in the
`git source repository <https://github.com/ansible-community/ara/tree/master/contrib/container-images>`_:
The different scripts to build container images are available in the git repository:
- ``fedora-distribution.sh``: Builds an image from Fedora 32 `distribution packages <https://koji.fedoraproject.org/koji/packageinfo?packageID=24394>`_
- ``fedora-pypi.sh``: Builds an image from `PyPi <https://pypi.org/project/ara>`_ packages on Fedora 32
- ``fedora-source.sh``: Builds an image from `git source <https://github.com/ansible-community/ara>`_ on Fedora 32
- fedora32-distribution.sh_: Builds an image from Fedora 32 `distribution packages <https://koji.fedoraproject.org/koji/packageinfo?packageID=24394>`_
- fedora32-pypi.sh_: Builds an image from `PyPi <https://pypi.org/project/ara>`_ packages on Fedora 32
- fedora32-source.sh_: Builds an image from `git source <https://github.com/ansible-community/ara>`_ on Fedora 32
- centos8-pypi.sh_: Builds an image from `PyPi <https://pypi.org/project/ara>`_ packages on CentOS 8
.. _fedora32-distribution.sh: https://github.com/ansible-community/ara/blob/master/contrib/container-images/fedora32-distribution.sh
.. _fedora32-pypi.sh: https://github.com/ansible-community/ara/blob/master/contrib/container-images/fedora32-pypi.sh
.. _fedora32-source.sh: https://github.com/ansible-community/ara/blob/master/contrib/container-images/fedora32-source.sh
.. _centos8-pypi.sh: https://github.com/ansible-community/ara/blob/master/contrib/container-images/centos8-pypi.sh
The scripts have no arguments other than the ability to specify an optional name
and tag:
@ -39,7 +44,7 @@ and tag:
$ git clone https://github.com/ansible-community/ara
$ cd ara/contrib/container-images
$ ./fedora-source.sh ara-api:latest
$ ./fedora32-source.sh ara-api:latest
# [...]
Getting image source signatures
Copying blob 59bbb69efd73 skipped: already exists
@ -89,6 +94,7 @@ You can validate if the container is running properly with podman:
$ podman ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bc4b7630c265 localhost/ara-api:latest /usr/bin/gunicorn... 12 seconds ago Up 11 seconds ago 0.0.0.0:8000->8000/tcp api-server
$ podman logs api-server
[ara] No setting found for SECRET_KEY. Generating a random key...
[ara] Writing default settings to /opt/ara/settings.yaml

View File

@ -25,14 +25,17 @@
# These are in chronological order of release so that we don't end up
# running SQL migrations backwards during the tests.
- name: localhost/ara-api
tag: distribution-latest
script: fedora-distribution.sh
tag: fedora32-source-latest
script: fedora32-source.sh
- name: localhost/ara-api
tag: pypi-latest
script: fedora-pypi.sh
tag: fedora32-pypi-latest
script: fedora32-pypi.sh
- name: localhost/ara-api
tag: source-latest
script: fedora-source.sh
tag: centos8-pypi-latest
script: centos8-pypi.sh
- name: localhost/ara-api
tag: fedora32-distribution-latest
script: fedora32-distribution.sh
tasks:
- name: Install git, buildah and podman
become: yes

View File

@ -23,20 +23,22 @@
images:
# These images are meant to be provided by the "with_container_images.yaml" playbook
- name: localhost/ara-api
tag: distribution-latest
tag: fedora32-source-latest
- name: localhost/ara-api
tag: pypi-latest
tag: fedora32-pypi-latest
- name: localhost/ara-api
tag: source-latest
tag: centos8-pypi-latest
- name: localhost/ara-api
tag: fedora32-distribution-latest
tasks:
- name: Tag images with buildah
command: |
buildah tag {{ item.name }}:{{ item.tag }} {{ destination }}:{{ item.tag }}
loop: "{{ images }}"
- name: Tag latest from source-latest
- name: Tag latest from fedora32-source-latest
command: |
buildah tag {{ destination }}:source-latest {{ destination }}:latest
buildah tag {{ destination }}:fedora32-source-latest {{ destination }}:latest
- name: Push latest
command: |