From b2383ea73cb2ee78af2720a36786566c8a1f5c05 Mon Sep 17 00:00:00 2001 From: Timo Furrer <tfurrer@gitlab.com> Date: Tue, 23 Jan 2024 09:35:34 +0100 Subject: [PATCH] Document job templates --- .gitlab/README.md | 34 +++++++++++++++++++++++++++++++--- README.md | 34 +++++++++++++++++++++++++++++++--- 2 files changed, 62 insertions(+), 6 deletions(-) diff --git a/.gitlab/README.md b/.gitlab/README.md index 571b013..b16477e 100644 --- a/.gitlab/README.md +++ b/.gitlab/README.md @@ -30,7 +30,7 @@ include: - component: gitlab.com/components/opentofu/full-pipeline@<VERSION> inputs: # The version must currently be specified explicitly as an input, - # to find the correctly associated images. # This can be removed + # to find the correctly associated images. # This can be removed # once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved. version: <VERSION> opentofu_version: <OPENTOFU_VERSION> @@ -46,7 +46,7 @@ include: - component: gitlab.com/components/opentofu/full-pipeline@~latest inputs: # The version must currently be specified explicitly as an input, - # to find the correctly associated images. # This can be removed + # to find the correctly associated images. # This can be removed # once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved. version: latest opentofu_version: 1.6.0 @@ -60,7 +60,7 @@ include: - component: gitlab.com/components/opentofu/full-pipeline@0.0.0-alpha1 inputs: # The version must currently be specified explicitly as an input, - # to find the correctly associated images. # This can be removed + # to find the correctly associated images. # This can be removed # once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved. version: 0.0.0-alpha1 opentofu_version: 1.6.0 @@ -68,6 +68,34 @@ include: stages: [validate, test, build, deploy, cleanup] ``` +Instead of including the `full-pipeline`, it's also possible to include individual jobs +and compose your own pipeline, for example, to just run the `fmt` job you can do: + +```yaml +include: + - component: gitlab.com/components/opentofu/fmt@latest + inputs: + # The version must currently be specified explicitly as an input, + # to find the correctly associated images. # This can be removed + # once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved. + version: latest + opentofu_version: 1.6.0 + root_dir: tofu/ +``` + +Have a look at the [`full-pipeline`](templates/full-pipeline.yml) for how it's constructed. + +The following job components exist: + +- [`fmt`](templates/fmt.yml) +- [`validate`](templates/validate.yml) +- [`plan`](templates/plan.yml) +- [`apply`](templates/apply.yml) +- [`destroy`](templates/destroy.yml) +- [`delete-state`](templates/delete-state.yml) + +Have a look at the individual template spec to learn about the available inputs. + ### Inputs | Name | Default | Description | diff --git a/README.md b/README.md index 99768d1..74e64f9 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ include: - component: gitlab.com/components/opentofu/full-pipeline@<VERSION> inputs: # The version must currently be specified explicitly as an input, - # to find the correctly associated images. # This can be removed + # to find the correctly associated images. # This can be removed # once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved. version: <VERSION> opentofu_version: <OPENTOFU_VERSION> @@ -48,7 +48,7 @@ include: - component: gitlab.com/components/opentofu/full-pipeline@~latest inputs: # The version must currently be specified explicitly as an input, - # to find the correctly associated images. # This can be removed + # to find the correctly associated images. # This can be removed # once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved. version: latest opentofu_version: 1.6.0 @@ -62,7 +62,7 @@ include: - component: gitlab.com/components/opentofu/full-pipeline@0.0.0-alpha1 inputs: # The version must currently be specified explicitly as an input, - # to find the correctly associated images. # This can be removed + # to find the correctly associated images. # This can be removed # once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved. version: 0.0.0-alpha1 opentofu_version: 1.6.0 @@ -70,6 +70,34 @@ include: stages: [validate, test, build, deploy, cleanup] ``` +Instead of including the `full-pipeline`, it's also possible to include individual jobs +and compose your own pipeline, for example, to just run the `fmt` job you can do: + +```yaml +include: + - component: gitlab.com/components/opentofu/fmt@latest + inputs: + # The version must currently be specified explicitly as an input, + # to find the correctly associated images. # This can be removed + # once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved. + version: latest + opentofu_version: 1.6.0 + root_dir: tofu/ +``` + +Have a look at the [`full-pipeline`](templates/full-pipeline.yml) for how it's constructed. + +The following job components exist: + +- [`fmt`](templates/fmt.yml) +- [`validate`](templates/validate.yml) +- [`plan`](templates/plan.yml) +- [`apply`](templates/apply.yml) +- [`destroy`](templates/destroy.yml) +- [`delete-state`](templates/delete-state.yml) + +Have a look at the individual template spec to learn about the available inputs. + ### Inputs | Name | Default | Description | -- GitLab