From afe098a9285b8304d9eaa126803bb419baa3e3eb Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 13 Apr 2023 08:34:16 +0200 Subject: 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. --- .gitlab-ci/ci.template | 10 +++++----- .gitlab-ci/config.yml | 18 +++++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to '.gitlab-ci') diff --git a/.gitlab-ci/ci.template b/.gitlab-ci/ci.template index 521896ea00..da7a51f369 100644 --- a/.gitlab-ci/ci.template +++ b/.gitlab-ci/ci.template @@ -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: diff --git a/.gitlab-ci/config.yml b/.gitlab-ci/config.yml index 91c7d59c1c..8aafe0c48b 100644 --- a/.gitlab-ci/config.yml +++ b/.gitlab-ci/config.yml @@ -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' -- cgit v1.2.1