From 560f8c5d2feb86f7cfae9b4451284c28a1b0b880 Mon Sep 17 00:00:00 2001 From: David Moreau Simard Date: Thu, 23 Jul 2020 19:59:47 -0400 Subject: [PATCH] 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]: https://github.com/ansible-community/ara/commit/8491cc5a72e24de5e1f608f39ba7c0997601c279 [2]: https://hub.docker.com/r/recordsansible/ara-api Change-Id: I971abd97039a28e825b6b7cd43a7559abe709f30 --- contrib/container-images/README.rst | 18 ++++++++++++------ .../centos8-pypi.sh} | 0 ...istribution.sh => fedora32-distribution.sh} | 0 .../{fedora-pypi.sh => fedora32-pypi.sh} | 0 .../{fedora-source.sh => fedora32-source.sh} | 0 tests/with_container_images.yaml | 15 +++++++++------ tests/zuul_publish_dockerhub.yaml | 12 +++++++----- 7 files changed, 28 insertions(+), 17 deletions(-) rename contrib/{centos-8-pypi.sh => container-images/centos8-pypi.sh} (100%) rename contrib/container-images/{fedora-distribution.sh => fedora32-distribution.sh} (100%) rename contrib/container-images/{fedora-pypi.sh => fedora32-pypi.sh} (100%) rename contrib/container-images/{fedora-source.sh => fedora32-source.sh} (100%) diff --git a/contrib/container-images/README.rst b/contrib/container-images/README.rst index b56aaf68..4d52b219 100644 --- a/contrib/container-images/README.rst +++ b/contrib/container-images/README.rst @@ -25,12 +25,17 @@ Building an image with buildah You will need to install `buildah `_. -The different scripts to build container images are available in the -`git source repository `_: +The different scripts to build container images are available in the git repository: -- ``fedora-distribution.sh``: Builds an image from Fedora 32 `distribution packages `_ -- ``fedora-pypi.sh``: Builds an image from `PyPi `_ packages on Fedora 32 -- ``fedora-source.sh``: Builds an image from `git source `_ on Fedora 32 +- fedora32-distribution.sh_: Builds an image from Fedora 32 `distribution packages `_ +- fedora32-pypi.sh_: Builds an image from `PyPi `_ packages on Fedora 32 +- fedora32-source.sh_: Builds an image from `git source `_ on Fedora 32 +- centos8-pypi.sh_: Builds an image from `PyPi `_ 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 diff --git a/contrib/centos-8-pypi.sh b/contrib/container-images/centos8-pypi.sh similarity index 100% rename from contrib/centos-8-pypi.sh rename to contrib/container-images/centos8-pypi.sh diff --git a/contrib/container-images/fedora-distribution.sh b/contrib/container-images/fedora32-distribution.sh similarity index 100% rename from contrib/container-images/fedora-distribution.sh rename to contrib/container-images/fedora32-distribution.sh diff --git a/contrib/container-images/fedora-pypi.sh b/contrib/container-images/fedora32-pypi.sh similarity index 100% rename from contrib/container-images/fedora-pypi.sh rename to contrib/container-images/fedora32-pypi.sh diff --git a/contrib/container-images/fedora-source.sh b/contrib/container-images/fedora32-source.sh similarity index 100% rename from contrib/container-images/fedora-source.sh rename to contrib/container-images/fedora32-source.sh diff --git a/tests/with_container_images.yaml b/tests/with_container_images.yaml index 29f4d957..982ae841 100644 --- a/tests/with_container_images.yaml +++ b/tests/with_container_images.yaml @@ -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 diff --git a/tests/zuul_publish_dockerhub.yaml b/tests/zuul_publish_dockerhub.yaml index f490392a..d89067d0 100644 --- a/tests/zuul_publish_dockerhub.yaml +++ b/tests/zuul_publish_dockerhub.yaml @@ -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: |