gitlab-ci: add multiple stages/tiers for tests

We have many test configurations (i.e. distros like fedora:37,
debian:9).  Almost all of them run manually triggered, because running
them every time would be wasteful.

Still, even as we trigger those tests only seldom, whenever we trigger
them all together, they consume still too many resources of the
freedesktop.org gitlab infrastructure.

One possibility would be to just drop old distros (e.g. fedora:30).
Which tests are setup in gitlab-ci is constantly refined and adjusted.
So dropping some distros is not necessarily wrong and bound to happen
eventually.

However, I also don't find it great to just disable tests that are still
passing. If we want to avoid consuming too many resources, we can just
choose not to run those tests. We don't need to enforce that by deleting
tests. Once deleted, such a configuration cannot be tested anymore as it
would be too cumbersome to recreate the setup manually.

Instead, introduce stages/tiers to clearer mark configuration that we
should test even less frequently.

Note that it is still required from the developer to not trigger too
many tests at once, to not monopolize the CI resources. The stages
should make that clearer to see, but don't solve it. Deleting tests
might solve it, but only if we delete a significant number of those
tests, which seems not desirable.
This commit is contained in:
Thomas Haller 2023-04-11 12:23:30 +02:00
parent aa74fec602
commit 853d8d4260
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
3 changed files with 454 additions and 353 deletions

File diff suppressed because it is too large Load diff

View file

@ -17,17 +17,37 @@
.templates_sha: &template_sha ffe4d1b10aab7534489f0c4bbc4c5899df17d3f2 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
{# Group distros by their common (name,base_type,tag) tuples.#}
{% set distro_groups = [] %}
{% for distro in distributions %}
{% set g = {'name':distro.name,'base_type':distro.base_type,'tag':distro.tag} %}
{% if g not in distro_groups %}
{% do distro_groups.append(g) %}
{% endif %}
{% endfor %}
{# The "default_distro" builds our pages and is used for check-{tree,patch} tests. It is the first distro with tier 1. #}
{% set default_distro = [] %}
{% for distro in distributions %}
{% if distro.tier == 1 and default_distro|length == 0 %}
{% do default_distro.append(distro) %}
{% endif %}
{% endfor %}
{% set default_distro = default_distro[0] %}
include:
{% for distro in distributions|sort(attribute="name") %}
# {{ distro.name.capitalize() }} container builder template
{% for distro_group in distro_groups|sort(attribute='name') %}
# {{ distro_group.name.capitalize() }} container builder template
- project: 'freedesktop/ci-templates'
ref: *template_sha
file: '/templates/{{distro.name}}.yml'
file: '/templates/{{distro_group.name}}.yml'
{% endfor %}
stages:
- prep
- test
- tier1
- tier2
- tier3
- deploy
- triage
- container_clean
@ -41,17 +61,17 @@ variables:
#
# This is done by running `ci-fairy generate-template` and possibly bumping
# ".default_tag".
{% for distro in distributions %}
{{"%-13s"| format(distro.name.upper() + '_TAG:')}}'{{distro.tag}}-{{
{% for distro_group in distro_groups|sort(attribute='name') %}
{{"%-13s"| format(distro_group.name.upper() + '_TAG:')}}'{{distro_group.tag}}-{{
(ci_fairy.hashfiles('./.gitlab-ci/config.yml',
'./.gitlab-ci/ci.template',
'./.gitlab-ci/' + distro.base_type + '-install.sh',
'./contrib/' + distro.base_type + '/REQUIRED_PACKAGES'))[0:12]
'./.gitlab-ci/' + distro_group.base_type + '-install.sh',
'./contrib/' + distro_group.base_type + '/REQUIRED_PACKAGES'))[0:12]
}}'
{% endfor %}
{% for distro in distributions %}
{{"%-13s"| format(distro.name.upper() + '_EXEC:')}}'bash .gitlab-ci/{{distro.base_type}}-install.sh'
{% for distro_group in distro_groups|sort(attribute='name') %}
{{"%-13s"| format(distro_group.name.upper() + '_EXEC:')}}'bash .gitlab-ci/{{distro_group.base_type}}-install.sh'
{% endfor %}
.nm_artifacts:
@ -93,6 +113,9 @@ variables:
FDO_DISTRIBUTION_VERSION: '{{version}}'
FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_TAG
FDO_DISTRIBUTION_EXEC: ${{distro.name.upper()}}_EXEC
{% if distro.tier > 1 %}
when: manual
{% endif %}
{% endfor %}
{% endfor %}
@ -151,7 +174,6 @@ variables:
#################################################################
.build@template:
stage: test
script:
- env
- r=0
@ -174,12 +196,12 @@ t_{{distro.name}}:{{version}}:
extends:
- .build@template
- .fdo.distribution-image@{{distro.name}}
{% if distro.name == pages_build.name and
version == pages_build.version %}
{% if distro == default_distro %}
- .nm_artifacts
{% else %}
- .nm_artifacts_debug
{% endif %}
stage: tier{{distro.tier}}
variables:
FDO_DISTRIBUTION_VERSION: '{{version}}'
FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_TAG
@ -191,7 +213,7 @@ t_{{distro.name}}:{{version}}:
{% endif %}
needs:
- "{{distro.name}}:{{version}}@container-prep"
{% if not version in distro.get('always', []) and (distro.name != pages_build.name or version != pages_build.version) %}
{% if distro.tier > 1 %}
when: manual
{% endif %}
{% endfor %}
@ -205,26 +227,26 @@ t_{{distro.name}}:{{version}}:
check-patch:
extends:
- .fdo.distribution-image@{{pages_build.name}}
- .fdo.distribution-image@{{default_distro.name}}
variables:
FDO_DISTRIBUTION_VERSION: '{{pages_build.version}}'
FDO_DISTRIBUTION_TAG: ${{pages_build.name.upper()}}_TAG
FDO_DISTRIBUTION_VERSION: '{{default_distro.versions[0]}}'
FDO_DISTRIBUTION_TAG: ${{default_distro.name.upper()}}_TAG
needs:
- "{{pages_build.name}}:{{pages_build.version}}@container-prep"
stage: test
- "{{default_distro.name}}:{{default_distro.versions[0]}}@container-prep"
stage: tier1
script:
- date '+%Y%m%d-%H%M%S'; NM_CHECKPATCH_FETCH_UPSTREAM=1 contrib/scripts/checkpatch-feature-branch.sh
allow_failure: true
check-tree:
extends:
- .fdo.distribution-image@{{pages_build.name}}
- .fdo.distribution-image@{{default_distro.name}}
variables:
FDO_DISTRIBUTION_VERSION: '{{pages_build.version}}'
FDO_DISTRIBUTION_TAG: ${{pages_build.name.upper()}}_TAG
FDO_DISTRIBUTION_VERSION: '{{default_distro.versions[0]}}'
FDO_DISTRIBUTION_TAG: ${{default_distro.name.upper()}}_TAG
needs:
- "{{pages_build.name}}:{{pages_build.version}}@container-prep"
stage: test
- "{{default_distro.name}}:{{default_distro.versions[0]}}@container-prep"
stage: tier1
script:
- date '+%Y%m%d-%H%M%S'; contrib/scripts/nm-python-black-format.sh --check
- date '+%Y%m%d-%H%M%S'; git ls-files -z -- 'po/*.po' | xargs -0 -n1 msgfmt -vc
@ -242,9 +264,9 @@ pages:
only:
- main
dependencies:
- t_{{pages_build.name}}:{{pages_build.version}}
- t_{{default_distro.name}}:{{default_distro.versions[0]}}
needs:
- t_{{pages_build.name}}:{{pages_build.version}}
- t_{{default_distro.name}}:{{default_distro.versions[0]}}
triage:issues:
stage: triage

View file

@ -8,7 +8,7 @@
#
# We're happy to rebuild all containers when one changes.
.default_tag: &default_tag '2023-01-18.0'
.default_tag: &default_tag '2023-04-11.0'
# The list of all distributions we want to create job for.
@ -17,6 +17,21 @@ distributions:
- name: fedora
tag: *default_tag
base_type: fedora
# Tier1 is used to build the pages and check-{tree,patch}
tier: 1
versions:
- '37'
- name: fedora
tag: *default_tag
base_type: fedora
tier: 2
versions:
- '36'
- '38'
- name: fedora
tag: *default_tag
base_type: fedora
tier: 3
versions:
- '30'
- '31'
@ -24,12 +39,10 @@ distributions:
- '33'
- '34'
- '35'
- '36'
- '37'
- '38'
- name: ubuntu
tag: *default_tag
base_type: debian
tier: 2
versions:
- '18.04'
- '20.04'
@ -39,31 +52,39 @@ distributions:
- name: debian
tag: *default_tag
base_type: debian
tier: 2
versions:
- '9'
- '10'
- '11'
- 'testing'
- 'sid'
- name: debian
tag: *default_tag
base_type: debian
tier: 3
versions:
- '9'
- 'testing'
- name: centos
tag: *default_tag
base_type: fedora
tier: 2
versions:
- '7.5.1804'
- '7.9.2009'
- '8.1.1911'
- '8.3.2011'
- name: centos
tag: *default_tag
base_type: fedora
tier: 3
versions:
- '7.6.1810'
- '7.7.1908'
- '7.8.2003'
- '7.9.2009'
- '8.1.1911'
- '8.2.2004'
- '8.3.2011'
- name: alpine
tag: *default_tag
base_type: alpine
tier: 2
versions:
- 'latest'
# specifies which of the above distros is used as source for pages
pages_build:
name: fedora
version: '37'