Commit 96b621fe authored by Peter Hutterer's avatar Peter Hutterer
Browse files

doc: document the container image labels

Especially the pipeline_id is important since it's used to trigger rebuilds
for dependent images based on FDO_BASE_IMAGE.
Signed-off-by: Peter Hutterer's avatarPeter Hutterer <>
parent 8f64cd81
......@@ -309,6 +309,73 @@ any failed call does not immediately terminate the CI job but allows for the
proper cleanup of the VM. The ``.success`` file is what determines the
actual success status of the CI job.
.. templates_container_labels:
Image labels
Images built with the CI templates have a number of labels set that can be
used by jobs or the GitLab setup itself. The example below shows how to
access the labels from a CI job using `skopeo
<>`__ and `jq
.. code-block:: yaml
check label:
- .myproject.fedora:30 # our template job above
- .fdo.distribution_image@fedora
# We don't want/need to use the actual image we built earlier, we can use
# any image that has skopeo and jq, or install those as part of
# script:
image: any-image-with-skopeo-and-jq
# FDO_DISTRIBUTION_IMAGE still has indirections
# retrieve the infos from the registry (once)
- JSON_IMAGE=$(skopeo inspect docker://$DISTRO_IMAGE)
# Parse the the pipeline_id label
- IMAGE_PIPELINE_ID=$(echo $JSON_IMAGE | jq -r '.Labels["fdo.pipeline_id"]')
# If the image was built as part of this pipeline, the image's pipeline
# ID is the same as the current pipeline ID.
# This can be used to poke other projects to rebuild dependent images.
- if [[ x"$IMAGE_PIPELINE_ID" == x"$CI_PIPELINE_ID" ]]; then
echo "Image was built in this pipeline"
.. note:: Extending from ``.fdo.distribution_image@fedora`` provides
``FDO_DISTRIBUTION_IMAGE``. We do not actually use the image
itself, any image with ``skopeo`` and ``jq`` will work here.
The labels currently set by the CI templates are as follows:
.. list-table::
* - Image Label
- Value
* - ``fdo.pipeline_id``
* - ``fdo.job_id``
- ``$CI_JOB_ID``
* - ``fdo.commit``
* - ``fdo.project``
* - ``fdo.upstream-repo``
- ``$FDO_UPSTREAM_REPO`` (optional)
* - ``fdo.expires-after``
- ``$FDO_EXPIRES_AFTER`` (optional)
For the values starting with ``CI_``, see the `GitLab
environment variables documentation
As in the example above, the image's ``fdo.pipeline_id`` can be used to
check if an image was built as part of the current pipeline.
.. _templates_deleting_containers:
Deleting container images
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment