Commit 8bea1f04 authored by Peter Hutterer's avatar Peter Hutterer
Browse files

Restore the ci-fairy images


Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent 28e71841
Pipeline #231752 passed with stages
in 1 minute and 37 seconds
......@@ -2,6 +2,7 @@ stages:
- sanity check
- bootstrapping
- distributions
- ci-fairy
- deploy
- publish
- test published images
......@@ -70,24 +71,6 @@ flake8 ci-fairy:
- flake8 --ignore=W501,E501,W504,W741,E741
check merge request:
extends: .pip_install
stage: deploy
script:
- pip3 install .
- ci-fairy check-merge-request --require-allow-collaboration --junit-xml=check-merge-request.xml
artifacts:
expire_in: 1 week
when: on_failure
paths:
- check-merge-request.xml
reports:
junit: check-merge-request.xml
variables:
FDO_UPSTREAM_REPO: freedesktop/ci-templates
# We allow this to fail because no MR may have been filed yet
allow_failure: true
bootstrapping:
stage: bootstrapping
trigger:
......@@ -138,6 +121,42 @@ ubuntu:
strategy: depend
ci-fairy images:
stage: ci-fairy
trigger:
include:
- local: '/.gitlab-ci/ci-fairy-ci.yml'
strategy: depend
.ci-fairy-tag:
variables:
FDO_DISTRIBUTION_TAG: sha256-3cb21c3654a7ab78cb20e216c9ef46c4f357df22b27d243cc6751a39a6d96fb6
.ci-fairy-local-image:
extends:
- .ci-fairy-tag
image: $CI_REGISTRY_IMAGE/ci-fairy:$FDO_DISTRIBUTION_TAG
check merge request:
extends:
- .ci-fairy-local-image
stage: deploy
script:
- ci-fairy check-merge-request --require-allow-collaboration --junit-xml=check-merge-request.xml
artifacts:
expire_in: 1 week
when: on_failure
paths:
- check-merge-request.xml
reports:
junit: check-merge-request.xml
variables:
FDO_UPSTREAM_REPO: freedesktop/ci-templates
# We allow this to fail because no MR may have been filed yet
allow_failure: true
pages:
extends: .pip_install
stage: deploy
......@@ -226,6 +245,18 @@ publish to quay.io:
rules:
- if: '$CI_COMMIT_BRANCH == "master" && $CI_PROJECT_PATH == "freedesktop/ci-templates"'
#
# Publish our ci-fairy image on quay.io
#
publish ci-fairy to quay.io:
extends:
- .ci-fairy-tag
- .publish.template
variables:
LOCAL_IMAGE_SPEC: ci-fairy:$FDO_DISTRIBUTION_TAG
DISTANT_IMAGE_SPEC: ci-fairy-$FDO_DISTRIBUTION_TAG
rules:
- if: '$CI_COMMIT_BRANCH == "master" && $CI_PROJECT_PATH == "freedesktop/ci-templates"'
#
# Verify that all quay.io images directly referenced by our templates
......@@ -237,6 +268,7 @@ test published images:
script:
- skopeo inspect docker://quay.io/freedesktop.org/ci-templates:buildah-aarch64-2020-10-30.1
- skopeo inspect docker://quay.io/freedesktop.org/ci-templates:buildah-x86_64-2020-10-30.1
- skopeo inspect docker://quay.io/freedesktop.org/ci-templates:ci-fairy-sha256-3cb21c3654a7ab78cb20e216c9ef46c4f357df22b27d243cc6751a39a6d96fb6
- skopeo inspect docker://quay.io/freedesktop.org/ci-templates:qemu-base-x86_64-2020-10-30.1
- skopeo inspect docker://quay.io/freedesktop.org/ci-templates:qemu-mkosi-base-x86_64-2020-10-30.1
rules:
......
include:
- local: '/templates/alpine.yml'
stages:
- base image build
- image build
# The ci-fairy base image. We build a base image that we can bump independently
# via the tag, ci-fairy itself gets layered on top with each commit.
# This image is private to ci-templates.
ci-fairy-base-image:
extends:
- .fdo.container-build@alpine@x86_64
stage: base image build
variables:
FDO_DISTRIBUTION_PACKAGES: 'git python3 py-pip bash'
FDO_DISTRIBUTION_TAG: ci-fairy-base-image-2020-11-03
FDO_REPO_SUFFIX: ci-fairy
.ci-fairy-tag:
variables:
FDO_DISTRIBUTION_TAG: sha256-3cb21c3654a7ab78cb20e216c9ef46c4f357df22b27d243cc6751a39a6d96fb6
# The actual ci-fairy image with ci-fairy installed
# This image uses the sha of the ci-fairy script itself as tag.
ci-fairy-image:
extends:
- .ci-fairy-tag
- .fdo.container-build@alpine@x86_64
stage: image build
variables:
FDO_BASE_IMAGE: $CI_REGISTRY_IMAGE/ci-fairy:ci-fairy-base-image-2020-11-03
FDO_DISTRIBUTION_EXEC: 'pip install .'
FDO_REPO_SUFFIX: ci-fairy
needs:
- ci-fairy-base-image
......@@ -9,6 +9,30 @@ a CI script where its arguments will be hardcoded and change very little.
It does not do a lot of error handling, expect to see exceptions where
things go wrong.
Use within gitlab-ci.yml
------------------------
The ``ci-fairy`` tool is available by extending the ``.fdo.ci-fairy``
template:
.. code-block:: yaml
include:
- project: 'freedesktop/ci-templates'
file: '/templates/ci-fairy.yml'
check-mr:
extends:
- .fdo.ci-fairy
script:
- ci-fairy check-merge-request --require-allow-collaboration
The ``.fdo.ci-fairy`` template guarantees the following preinstalled
packages: ``bash``, ``git``, ``python`` and ``pip``.
The distribution the template is based on is subject to change without
notice.
Installation
------------
......
include:
- local: '/templates/{{base_distro}}.yml'
stages:
- base image build
- image build
# The ci-fairy base image. We build a base image that we can bump independently
# via the tag, ci-fairy itself gets layered on top with each commit.
# This image is private to ci-templates.
ci-fairy-base-image:
extends:
- .fdo.container-build@{{base_distro}}@x86_64
stage: base image build
variables:
FDO_DISTRIBUTION_PACKAGES: '{{packages}}'
FDO_DISTRIBUTION_TAG: {{tag}}
FDO_REPO_SUFFIX: ci-fairy
.ci-fairy-tag:
variables:
FDO_DISTRIBUTION_TAG: {{ci_fairy.sha256sum(sha_source)}}
# The actual ci-fairy image with ci-fairy installed
# This image uses the sha of the ci-fairy script itself as tag.
ci-fairy-image:
extends:
- .ci-fairy-tag
- .fdo.container-build@{{base_distro}}@x86_64
stage: image build
variables:
FDO_BASE_IMAGE: $CI_REGISTRY_IMAGE/ci-fairy:{{tag}}
FDO_DISTRIBUTION_EXEC: 'pip install .'
FDO_REPO_SUFFIX: ci-fairy
needs:
- ci-fairy-base-image
###
# Generic template that provides the ``ci-fairy`` commandline tool, ``pip``
# and ``git``. This template is provided for convenience, it is not based on
# {{distribution}}.
#
# The ``ci-fairy`` capable image guarantees the following available packages:
# - git
# - python
# - pip
#
# This template sets ``image:`` to the ``ci-fairy`` capable image.
#
# **Example:**
#
# .. code-block:: yaml
#
# check-merge-request:
# extends: .fdo.ci-fairy
# script:
# - ci-fairy check-merge-request --require-allow-collaboration
#
# **Variables:**
#
# .. attribute:: FDO_DISTRIBUTION_IMAGE
#
# **This variable is set by this template and should be treated as read-only**
#
# Path to the registry image
#
#
# Variables provided by this template should be considered read-only.
#
.fdo.ci-fairy:
image: {{ci_templates_registry}}{{ci_templates_registry_path}}:ci-fairy-{{ci_fairy.sha256sum(sha_source)}}
variables:
FDO_DISTRIBUTION_IMAGE: {{ci_templates_registry}}{{ci_templates_registry_path}}:ci-fairy-{{ci_fairy.sha256sum(sha_source)}}
ci-fairy:
# The version we're building on
base_distro: 'alpine'
base_distro_version: 'latest'
packages: 'git python3 py-pip bash'
# Bump this tag to rebuild the base image
tag: 'ci-fairy-base-image-2020-11-03'
sha_source: './tools/ci_fairy.py'
......@@ -59,6 +59,17 @@ if __name__ == '__main__':
config = [(f'{globals_file}', None)]
generate_template(configs=config, dest=dest, template=template)
# Generate the ci-fairy template and its ci file
ci_fairy_file = src_folder / 'ci-fairy.yml'
template = src_folder / 'ci-fairy.tmpl'
dest = Path('templates') / 'ci-fairy.yml'
config = [(f'{globals_file}', ''), (f'{ci_fairy_file}', 'ci-fairy')]
generate_template(configs=config, dest=dest, template=template)
template = src_folder / 'ci-fairy-ci.tmpl'
dest = ci_folder / 'ci-fairy-ci.yml'
generate_template(configs=config, dest=dest, template=template)
# We've generated all the templates, search for any
# full image reference $registry/$path:$imagespec anywhere in your
# templates and add that to the remote_images so we can test those
......@@ -88,6 +99,7 @@ if __name__ == '__main__':
# now generate the .gitlab-ci.yml file
dest = Path('.gitlab-ci.yml')
template = src_folder / 'gitlab-ci.tmpl'
config = [(f'{globals_file}', None),
(f'{new_config.name}', None)]
config = [(f'{globals_file}', ''),
(f'{ci_fairy_file}', 'ci-fairy'),
(f'{new_config.name}', '')]
generate_template(configs=config, dest=dest, template=template)
......@@ -2,6 +2,7 @@ stages:
- sanity check
- bootstrapping
- distributions
- ci-fairy
- deploy
- publish
- test published images
......@@ -70,24 +71,6 @@ flake8 ci-fairy:
- flake8 --ignore=W501,E501,W504,W741,E741
check merge request:
extends: .pip_install
stage: deploy
script:
- pip3 install .
- ci-fairy check-merge-request --require-allow-collaboration --junit-xml=check-merge-request.xml
artifacts:
expire_in: 1 week
when: on_failure
paths:
- check-merge-request.xml
reports:
junit: check-merge-request.xml
variables:
FDO_UPSTREAM_REPO: freedesktop/ci-templates
# We allow this to fail because no MR may have been filed yet
allow_failure: true
bootstrapping:
stage: bootstrapping
trigger:
......@@ -105,6 +88,42 @@ bootstrapping:
{% endfor %}
ci-fairy images:
stage: ci-fairy
trigger:
include:
- local: '/.gitlab-ci/ci-fairy-ci.yml'
strategy: depend
.ci-fairy-tag:
variables:
FDO_DISTRIBUTION_TAG: {{ci_fairy.sha256sum(sha_source)}}
.ci-fairy-local-image:
extends:
- .ci-fairy-tag
image: $CI_REGISTRY_IMAGE/ci-fairy:$FDO_DISTRIBUTION_TAG
check merge request:
extends:
- .ci-fairy-local-image
stage: deploy
script:
- ci-fairy check-merge-request --require-allow-collaboration --junit-xml=check-merge-request.xml
artifacts:
expire_in: 1 week
when: on_failure
paths:
- check-merge-request.xml
reports:
junit: check-merge-request.xml
variables:
FDO_UPSTREAM_REPO: freedesktop/ci-templates
# We allow this to fail because no MR may have been filed yet
allow_failure: true
pages:
extends: .pip_install
stage: deploy
......@@ -193,6 +212,18 @@ publish to {{ci_templates_registry}}:
rules:
- if: '$CI_COMMIT_BRANCH == "master" && $CI_PROJECT_PATH == "freedesktop/ci-templates"'
#
# Publish our ci-fairy image on quay.io
#
publish ci-fairy to {{ci_templates_registry}}:
extends:
- .ci-fairy-tag
- .publish.template
variables:
LOCAL_IMAGE_SPEC: ci-fairy:$FDO_DISTRIBUTION_TAG
DISTANT_IMAGE_SPEC: ci-fairy-$FDO_DISTRIBUTION_TAG
rules:
- if: '$CI_COMMIT_BRANCH == "master" && $CI_PROJECT_PATH == "freedesktop/ci-templates"'
#
# Verify that all {{ci_templates_registry}} images directly referenced by our templates
......
###
# Generic template that provides the ``ci-fairy`` commandline tool, ``pip``
# and ``git``. This template is provided for convenience, it is not based on
# .
#
# The ``ci-fairy`` capable image guarantees the following available packages:
# - git
# - python
# - pip
#
# This template sets ``image:`` to the ``ci-fairy`` capable image.
#
# **Example:**
#
# .. code-block:: yaml
#
# check-merge-request:
# extends: .fdo.ci-fairy
# script:
# - ci-fairy check-merge-request --require-allow-collaboration
#
# **Variables:**
#
# .. attribute:: FDO_DISTRIBUTION_IMAGE
#
# **This variable is set by this template and should be treated as read-only**
#
# Path to the registry image
#
#
# Variables provided by this template should be considered read-only.
#
.fdo.ci-fairy:
image: quay.io/freedesktop.org/ci-templates:ci-fairy-sha256-3cb21c3654a7ab78cb20e216c9ef46c4f357df22b27d243cc6751a39a6d96fb6
variables:
FDO_DISTRIBUTION_IMAGE: quay.io/freedesktop.org/ci-templates:ci-fairy-sha256-3cb21c3654a7ab78cb20e216c9ef46c4f357df22b27d243cc6751a39a6d96fb6
\ No newline at end of file
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