From 354c26bbbd3631b05bf7e931c313a23cca1f934d Mon Sep 17 00:00:00 2001 From: Toby Griffiths <toby@goodcrm.co.uk> Date: Wed, 30 Oct 2024 12:08:27 +0000 Subject: [PATCH] Add job_name_prefix as per full-pipeline template Similar to !153 this adds support for job name prefixes when using these templates. --- templates/validate-plan-apply.yml | 11 +++++++---- templates/validate-plan-destroy.yml | 13 ++++++++----- templates/validate-plan.yml | 9 ++++++--- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/templates/validate-plan-apply.yml b/templates/validate-plan-apply.yml index 04fdb4d..abf6c4f 100644 --- a/templates/validate-plan-apply.yml +++ b/templates/validate-plan-apply.yml @@ -70,6 +70,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.' @@ -89,7 +92,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 ]] @@ -100,7 +103,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 ]] @@ -112,7 +115,7 @@ include: state_name: $[[ inputs.state_name ]] - 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 ]] @@ -125,7 +128,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 ]] diff --git a/templates/validate-plan-destroy.yml b/templates/validate-plan-destroy.yml index e1c0b2d..28f3044 100644 --- a/templates/validate-plan-destroy.yml +++ b/templates/validate-plan-destroy.yml @@ -70,6 +70,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.' @@ -92,7 +95,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 ]] @@ -103,7 +106,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 ]] @@ -115,7 +118,7 @@ include: state_name: $[[ inputs.state_name ]] - 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 ]] @@ -130,7 +133,7 @@ include: destroy: true - 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 ]] @@ -145,7 +148,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 ]] diff --git a/templates/validate-plan.yml b/templates/validate-plan.yml index 709901f..e3c3085 100644 --- a/templates/validate-plan.yml +++ b/templates/validate-plan.yml @@ -67,6 +67,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.' @@ -82,7 +85,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 ]] @@ -93,7 +96,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 ]] @@ -105,7 +108,7 @@ include: state_name: $[[ inputs.state_name ]] - 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 ]] -- GitLab