base-jobs/playbooks/container-image
Clark Boylan 3fc688b08d Run ensure-quay-repo in our base container jobs
This will ensure that properly defined container images are created in
quay registries for us. You need to do this out of band of the docker
push if you want the image repos to be public. The ensure-quay-repo role
should ignore images that don't have the correct metadata making this
safe for all container base jobs.

Depends-On: https://review.opendev.org/c/zuul/zuul-jobs/+/881521
Change-Id: Ic358f5e2f44c2a1e02140f8c848fe352214ba65a
2023-04-25 15:28:39 -07:00
..
README.rst Add container-image jobs 2023-03-23 10:47:33 -07:00
credentials.rst Add container-image jobs 2023-03-23 10:47:33 -07:00
pre-quay.yaml Run ensure-quay-repo in our base container jobs 2023-04-25 15:28:39 -07:00
pre.yaml Move pull-from-intermediate-registry to localhost 2023-03-23 13:19:19 -07:00
run.yaml Add container-image jobs 2023-03-23 10:47:33 -07:00
upload.yaml Add container-image jobs 2023-03-23 10:47:33 -07:00

README.rst

This is one of a collection of jobs which are designed to work together to build, upload, and promote container images in a gating context:

  • :zuulopendev-build-container-image: Build the images.
  • :zuulopendev-upload-container-image: Build and stage the images in a registry.
  • :zuulopendev-promote-container-image: Promote previously uploaded images.

The :zuulopendev-build-container-image job is designed to be used in a check pipeline and simply builds the images to verify that the build functions.

The :zuulopendev-upload-container-image job builds and uploads the images to a registry, but only with a single tag corresponding to the change ID. This job is designed in a gate pipeline so that the build produced by the gate is staged and can later be promoted to production if the change is successful.

The :zuulopendev-promote-container-image job is designed to be used in a promote pipeline. It requires no nodes and runs very quickly on the Zuul executor. It simply re-tags a previously uploaded image for a change with whatever tags are supplied by :zuulopendev-build-container-image.container_images.tags. It also removes the change ID tag from the repository in the registry. If any changes fail to merge, this cleanup will not run and those tags will need to be deleted manually.

They all accept the same input data, principally a list of dictionaries representing the images to build. YAML anchors can be used to supply the same data to all three jobs.

Job Variables

The default container filename name to use. Serves as the base for :zuulopendev-build-container-image.container_images.container_filename. This allows a global overriding of the container filename name, for example when building all images from different folders with similarily named containerfiles.

If omitted, the default depends on the container command used. Typically, this is Dockerfile for docker and Containerfile (with a fallback on Dockerfile) for podman.