From 295afe6f508e3a614c0a784b1c046bafae8bbd7d Mon Sep 17 00:00:00 2001 From: Toby Griffiths <toby@goodcrm.co.uk> Date: Wed, 30 Oct 2024 11:32:06 +0000 Subject: [PATCH] Add support for job name prefix in full-pipeline This adds a new `job_name_prefix` input, the same as the `job-templates.yml` file so that this can be used mutiple times in the same config, for example to support multi-environment pipelines. --- templates/full-pipeline.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/templates/full-pipeline.yml b/templates/full-pipeline.yml index 265d27e..708f6dd 100644 --- a/templates/full-pipeline.yml +++ b/templates/full-pipeline.yml @@ -76,6 +76,9 @@ spec: description: 'Image digest of the image you want to use. The format must be `@<image_digest>`, e.g. `@sha256:abc..`, see regex of this input. Please consult the release page at https://gitlab.com/components/opentofu/-/releases to obtain the image digests.' # Configuration + job_name_prefix: + default: '' + description: 'Prefix for all job names. Jobs will be hidden if leading with a dot `.`.' root_dir: default: ${CI_PROJECT_DIR} description: 'Root directory for the OpenTofu project.' @@ -99,7 +102,7 @@ spec: include: - local: '/templates/fmt.yml' inputs: - as: 'fmt' + as: '$[[ inputs.job_name_prefix ]]fmt' stage: $[[ inputs.stage_validate ]] version: $[[ inputs.version ]] base_os: $[[ inputs.base_os ]] @@ -110,7 +113,7 @@ include: root_dir: $[[ inputs.root_dir ]] - local: '/templates/validate.yml' inputs: - as: 'validate' + as: '$[[ inputs.job_name_prefix ]]validate' stage: $[[ inputs.stage_validate ]] version: $[[ inputs.version ]] base_os: $[[ inputs.base_os ]] @@ -122,7 +125,7 @@ include: state_name: $[[ inputs.state_name ]] - local: '/templates/test.yml' inputs: - as: 'test' + as: '$[[ inputs.job_name_prefix ]]test' stage: $[[ inputs.stage_test ]] version: $[[ inputs.version ]] base_os: $[[ inputs.base_os ]] @@ -137,7 +140,7 @@ include: - $[[ inputs.root_dir ]]/**/*.tftest.hcl - local: '/templates/plan.yml' inputs: - as: 'plan' + as: '$[[ inputs.job_name_prefix ]]plan' stage: $[[ inputs.stage_build ]] version: $[[ inputs.version ]] base_os: $[[ inputs.base_os ]] @@ -150,7 +153,7 @@ include: artifacts_access: $[[ inputs.plan_artifacts_access ]] - local: '/templates/apply.yml' inputs: - as: 'apply' + as: '$[[ inputs.job_name_prefix ]]apply' stage: $[[ inputs.stage_deploy ]] version: $[[ inputs.version ]] base_os: $[[ inputs.base_os ]] @@ -163,7 +166,7 @@ include: auto_apply: $[[ inputs.auto_apply ]] - local: '/templates/destroy.yml' inputs: - as: 'destroy' + as: '$[[ inputs.job_name_prefix ]]destroy' stage: $[[ inputs.stage_cleanup ]] version: $[[ inputs.version ]] base_os: $[[ inputs.base_os ]] @@ -176,7 +179,7 @@ include: auto_destroy: $[[ inputs.auto_destroy ]] - local: '/templates/delete-state.yml' inputs: - as: 'delete-state' + as: '$[[ inputs.job_name_prefix ]]delete-state' stage: $[[ inputs.stage_cleanup ]] state_name: $[[ inputs.state_name ]] -- GitLab