gitlab-ci: extract base_type for distros to reduce redundant information

The distro.name is not just a pretty name, its the name under which we fetch
the container. It is thus a well-known name, that we can rely on.

The "base_type" only depends on the distro name, and it makes no sense
to ever choose a different name. Tracking it in the "distributions"
array is thus redundant.

Move the mapping of distro.name to the base type to a separate place.
This commit is contained in:
Thomas Haller 2023-04-13 08:34:16 +02:00
parent 8e37037e88
commit afe098a928
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
3 changed files with 19 additions and 19 deletions

View file

@ -57,11 +57,11 @@ variables:
#
# This is done by running `ci-fairy generate-template` and possibly bumping
# ".default_tag".
ALPINE_TAG: 'tag-0a615b61395f'
CENTOS_TAG: 'tag-87fa88557da7'
DEBIAN_TAG: 'tag-2edf40356382'
FEDORA_TAG: 'tag-87fa88557da7'
UBUNTU_TAG: 'tag-2edf40356382'
ALPINE_TAG: 'tag-93cf50e3b143'
CENTOS_TAG: 'tag-43e358544423'
DEBIAN_TAG: 'tag-08e17e4980fb'
FEDORA_TAG: 'tag-43e358544423'
UBUNTU_TAG: 'tag-08e17e4980fb'
ALPINE_EXEC: 'bash .gitlab-ci/alpine-install.sh'
CENTOS_EXEC: 'bash .gitlab-ci/fedora-install.sh'

View file

@ -17,10 +17,10 @@
.templates_sha: &template_sha ffe4d1b10aab7534489f0c4bbc4c5899df17d3f2 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
{# Group distros by their common (name,base_type) tuples.#}
{# Group distros by their common (name,) tuples.#}
{% set distro_groups = [] %}
{% for distro in distributions %}
{% set g = {'name':distro.name,'base_type':distro.base_type} %}
{% set g = {'name':distro.name} %}
{% if g not in distro_groups %}
{% do distro_groups.append(g) %}
{% endif %}
@ -65,13 +65,13 @@ variables:
{{"%-13s"| format(distro_group.name.upper() + '_TAG:')}}'tag-{{
(ci_fairy.hashfiles('./.gitlab-ci/config.yml',
'./.gitlab-ci/ci.template',
'./.gitlab-ci/' + distro_group.base_type + '-install.sh',
'./contrib/' + distro_group.base_type + '/REQUIRED_PACKAGES'))[0:12]
'./.gitlab-ci/' + base_types[distro_group.name] + '-install.sh',
'./contrib/' + base_types[distro_group.name] + '/REQUIRED_PACKAGES'))[0:12]
}}'
{% endfor %}
{% 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'
{{"%-13s"| format(distro_group.name.upper() + '_EXEC:')}}'bash .gitlab-ci/{{base_types[distro_group.name]}}-install.sh'
{% endfor %}
.nm_artifacts:

View file

@ -7,22 +7,28 @@
# https://gitlab.freedesktop.org/freedesktop/ci-templates
#
# Some distros are fairly similar, and we reuse similar scripts.
# The base type maps the distro name to their base.
base_types:
fedora: fedora
centos: fedora
debian: debian
ubuntu: debian
alpine: alpine
# The list of all distributions we want to create job for.
distributions:
- name: fedora
base_type: fedora
# The first tier:1 in the list is used to build the pages and check-{tree,patch}
tier: 1
versions:
- '37'
- name: fedora
base_type: fedora
tier: 2
versions:
- '36'
- '38'
- name: fedora
base_type: fedora
tier: 3
versions:
- '30'
@ -32,7 +38,6 @@ distributions:
- '34'
- '35'
- name: ubuntu
base_type: debian
tier: 2
versions:
- '18.04'
@ -41,20 +46,17 @@ distributions:
- 'devel'
- 'rolling'
- name: debian
base_type: debian
tier: 2
versions:
- '10'
- '11'
- 'sid'
- name: debian
base_type: debian
tier: 3
versions:
- '9'
- 'testing'
- name: centos
base_type: fedora
tier: 2
versions:
- '7.5.1804'
@ -62,7 +64,6 @@ distributions:
- '8.1.1911'
- '8.3.2011'
- name: centos
base_type: fedora
tier: 3
versions:
- '7.6.1810'
@ -70,7 +71,6 @@ distributions:
- '7.8.2003'
- '8.2.2004'
- name: alpine
base_type: alpine
tier: 2
versions:
- 'latest'