From b2cb5dc4d56a96eaffd4772a20fc7fbdf95ce59f Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Mon, 27 Feb 2023 17:36:36 +0100 Subject: gitlab: Always format 'variables:' using 'format_variables' helper Convert few job templates that formatted variables inline to use the common helper. Signed-off-by: Peter Krempa --- lcitool/gitlab.py | 45 ++++++++++++---------- .../data/manifest/out/ci/gitlab/sanity-checks.yml | 10 ++--- 2 files changed, 30 insertions(+), 25 deletions(-) diff --git a/lcitool/gitlab.py b/lcitool/gitlab.py index 85ffb42..3954fb1 100644 --- a/lcitool/gitlab.py +++ b/lcitool/gitlab.py @@ -446,58 +446,63 @@ def code_fmt_template(): def cargo_fmt_job(): + jobvars = { + "NAME": "cargo-fmt", + "EXT": "txt" + } return textwrap.dedent( """ cargo-fmt: extends: .code_format - variables: - NAME: cargo-fmt - EXT: txt - """) + """) + format_variables(jobvars) def go_fmt_job(): + jobvars = { + "NAME": "go-fmt", + "EXT": "patch" + } return textwrap.dedent( """ go-fmt: extends: .code_format - variables: - NAME: go-fmt - EXT: patch - """) + """) + format_variables(jobvars) def clang_format_job(): + jobvars = { + "NAME": "clang-format", + "EXT": "patch" + } return textwrap.dedent( """ clang-format: extends: .code_format - variables: - NAME: clang-format - EXT: patch - """) + """) + format_variables(jobvars) def black_job(): + jobvars = { + "NAME": "black", + "EXT": "txt" + } return textwrap.dedent( """ black: extends: .code_format - variables: - NAME: black - EXT: txt - """) + """) + format_variables(jobvars) def flake8_job(): + jobvars = { + "NAME": "flake8", + "EXT": "txt" + } return textwrap.dedent( """ flake8: extends: .code_format - variables: - NAME: flake8 - EXT: txt - """) + """) + format_variables(jobvars) def _container_job(target, arch, image, allow_failure, optional): diff --git a/tests/data/manifest/out/ci/gitlab/sanity-checks.yml b/tests/data/manifest/out/ci/gitlab/sanity-checks.yml index 07cc27e..c158176 100644 --- a/tests/data/manifest/out/ci/gitlab/sanity-checks.yml +++ b/tests/data/manifest/out/ci/gitlab/sanity-checks.yml @@ -52,33 +52,33 @@ check-dco: cargo-fmt: extends: .code_format variables: - NAME: cargo-fmt EXT: txt + NAME: cargo-fmt go-fmt: extends: .code_format variables: - NAME: go-fmt EXT: patch + NAME: go-fmt clang-format: extends: .code_format variables: - NAME: clang-format EXT: patch + NAME: clang-format black: extends: .code_format variables: - NAME: black EXT: txt + NAME: black flake8: extends: .code_format variables: - NAME: flake8 EXT: txt + NAME: flake8 -- cgit v1.1