From 539c00a8a158691347514e10947adee622bc4042 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 17 Nov 2020 09:21:12 +0100 Subject: [PATCH] gitlab-ci: automatically hash build scripts into tag for ci-templates container ci-templates builds and caches the test containers. When the build scripts, the ci-template or "config.yml" changes, we need to bump the tag so that the containers get rebuild. Partly automate this. The tag now gets generated by the template and contains a checksum of certain build files. Thus, if you change any build files, then `ci-fairy generate-template` would generate a different tag. You can not miss that, because we have tests that ensure that our ".gitlab-ci.yml" is up to date. Also, you no longer need to manually bump the tag when a build script changes, just regenerate ".gitlab-ci.yml" with `ci-fairy generate-template`. See also: https://gitlab.freedesktop.org/freedesktop/ci-templates/-/merge_requests/54 --- .gitlab-ci.yml | 10 +++++----- .gitlab-ci/ci.template | 9 +++++++-- .gitlab-ci/config.yml | 6 +++++- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f95431a0e3..799107f28a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,7 +7,7 @@ ######################################## -.templates_sha: &template_sha d303fafa66bbca44cc5bdb337d5773b5f019b70d # see https://docs.gitlab.com/ee/ci/yaml/#includefile +.templates_sha: &template_sha 766e3d77c647e404b349e398427e8965a1769b64 # see https://docs.gitlab.com/ee/ci/yaml/#includefile include: # Centos container builder template @@ -41,10 +41,10 @@ variables: # changing these will force rebuilding the associated image # Note: these tags have no meaning and are not tied to a particular # libinput version - FEDORA_TAG: '2020-11-10.0' - UBUNTU_TAG: '2020-11-10.0' - DEBIAN_TAG: '2020-11-10.0' - CENTOS_TAG: '2020-11-10.0' + FEDORA_TAG: '2020-11-17.0-13e145ea4f89' + UBUNTU_TAG: '2020-11-17.0-a7a0eae3a046' + DEBIAN_TAG: '2020-11-17.0-f3fdbff29bf1' + CENTOS_TAG: '2020-11-17.0-5ab38b9bd66e' FEDORA_EXEC: 'bash .gitlab-ci/fedora-install.sh' UBUNTU_EXEC: 'bash .gitlab-ci/ubuntu-install.sh' diff --git a/.gitlab-ci/ci.template b/.gitlab-ci/ci.template index 7208aac299..229ba16d81 100644 --- a/.gitlab-ci/ci.template +++ b/.gitlab-ci/ci.template @@ -9,7 +9,7 @@ ######################################## -.templates_sha: &template_sha d303fafa66bbca44cc5bdb337d5773b5f019b70d # see https://docs.gitlab.com/ee/ci/yaml/#includefile +.templates_sha: &template_sha 766e3d77c647e404b349e398427e8965a1769b64 # see https://docs.gitlab.com/ee/ci/yaml/#includefile include: {% for distro in distributions|sort(attribute="name") %} @@ -34,7 +34,12 @@ variables: # Note: these tags have no meaning and are not tied to a particular # libinput version {% for distro in distributions %} - {{"%-13s"| format(distro.name.upper() + '_TAG:')}}'{{distro.tag}}' + {{"%-13s"| format(distro.name.upper() + '_TAG:')}}'{{distro.tag}}-{{ + (ci_fairy.hashfiles('./.gitlab-ci/config.yml', + './.gitlab-ci/ci.template', + './.gitlab-ci/' + distro.name + '-install.sh', + './contrib/' + distro.base_type + '/REQUIRED_PACKAGES'))[0:12] + }}' {% endfor %} {% for distro in distributions %} diff --git a/.gitlab-ci/config.yml b/.gitlab-ci/config.yml index 1d78da8fb6..6e6b8bc5e2 100644 --- a/.gitlab-ci/config.yml +++ b/.gitlab-ci/config.yml @@ -8,7 +8,7 @@ # # We're happy to rebuild all containers when one changes. -.default_tag: &default_tag '2020-11-10.0' +.default_tag: &default_tag '2020-11-17.0' # The list of all distributions we want to create job for. @@ -16,6 +16,7 @@ distributions: - name: fedora tag: *default_tag + base_type: fedora versions: - '28' - '29' @@ -28,6 +29,7 @@ distributions: - '33' - name: ubuntu tag: *default_tag + base_type: debian versions: - '16.04' - '18.04' @@ -36,6 +38,7 @@ distributions: - 'rolling' - name: debian tag: *default_tag + base_type: debian versions: - '9' - '10' @@ -43,6 +46,7 @@ distributions: - 'sid' - name: centos tag: *default_tag + base_type: fedora versions: - '7.5.1804' - '7.6.1810'