From 50d916467b75e5ca8944f8b4031d47dfd82a1847 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 20 Feb 2020 13:25:40 +1000 Subject: [PATCH] gitlab CI: use a separate variable for the template list Just because I feel more comfortable with having this code in python than in the templates. Signed-off-by: Peter Hutterer --- .gitlab-ci/generate-gitlab-ci.py | 5 ++++- .gitlab-ci/gitlab-ci.tmpl | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci/generate-gitlab-ci.py b/.gitlab-ci/generate-gitlab-ci.py index b3a05075..1b8720a7 100755 --- a/.gitlab-ci/generate-gitlab-ci.py +++ b/.gitlab-ci/generate-gitlab-ci.py @@ -26,6 +26,8 @@ distributions = [ } ] +templates = sorted(set([x['name'] for x in distributions])) + # in reverse order of duration to get the slowest ones started first test_suites = [ {'name': 'touchpad', 'suites': 'touchpad'}, @@ -44,7 +46,8 @@ def generate_template(): template = env.get_template('gitlab-ci.tmpl') config = {'distributions': distributions, - 'test_suites': test_suites} + 'test_suites': test_suites, + 'templates': templates} with open('.gitlab-ci.yml', 'w') as fd: template.stream(config).dump(fd) diff --git a/.gitlab-ci/gitlab-ci.tmpl b/.gitlab-ci/gitlab-ci.tmpl index 4d903f1c..102e9708 100644 --- a/.gitlab-ci/gitlab-ci.tmpl +++ b/.gitlab-ci/gitlab-ci.tmpl @@ -27,11 +27,11 @@ .templates_sha: &template_sha b7030c2cd0d6ccc5f6d4f8299bafa4daa9240d71 # see https://docs.gitlab.com/ee/ci/yaml/#includefile include: - {% for distribution in distributions|map(attribute='name')|unique()|sort() %} - # {{ distribution.capitalize() }} container builder template + {% for template in templates %} + # {{ template.capitalize() }} container builder template - project: 'wayland/ci-templates' ref: *template_sha - file: '/templates/{{distribution}}.yml' + file: '/templates/{{template}}.yml' {% endfor %} stages: