From 4827eb3c8f0a738bed6095f71a080ff4a6888f6b Mon Sep 17 00:00:00 2001
From: Timo Furrer <tfurrer@gitlab.com>
Date: Thu, 31 Oct 2024 15:23:58 +0100
Subject: [PATCH] Document renovate usage for version input

Changelog: added
---
 .gitlab/README.md.template        | 27 ++++++++++++++++++++++-----
 .gitlab/release-notes.md.template |  2 +-
 README.md                         | 27 ++++++++++++++++++++++-----
 3 files changed, 45 insertions(+), 11 deletions(-)

diff --git a/.gitlab/README.md.template b/.gitlab/README.md.template
index 2bc45df..e28b928 100644
--- a/.gitlab/README.md.template
+++ b/.gitlab/README.md.template
@@ -26,7 +26,7 @@ include:
       # 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: <VERSION>
+      version: <VERSION> # component version
       opentofu_version: <OPENTOFU_VERSION>
 
 stages: [validate, test, build, deploy, cleanup]
@@ -40,7 +40,7 @@ include:
       # 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: <VERSION>
+      version: <VERSION> # component version
       opentofu_version: <OPENTOFU_VERSION>
 
 stages: [validate, build, deploy]
@@ -56,7 +56,7 @@ include:
       # 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: 0.10.0
+      version: 0.10.0 # component version
       opentofu_version: 1.6.1
 
 stages: [validate, test, build, deploy, cleanup]
@@ -71,7 +71,7 @@ include:
       # 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
+      version: latest # component version
       opentofu_version: 1.6.1
 
 stages: [validate, test, build, deploy, cleanup]
@@ -86,7 +86,7 @@ include:
       # 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: <VERSION>
+      version: <VERSION> # component version
       opentofu_version: <OPENTOFU_VERSION>
 
 stages: [...]
@@ -365,6 +365,23 @@ so that the OpenTofu version is raised to a maximum of the version suitable for
   ...
 }
 ```
+
+The above renovate config allows to update the `version` input together with the component include
+version if the `version` input has a `# component version` comment suffix, like so:
+
+```yaml
+include:
+  - component: $CI_SERVER_FQDN/components/opentofu/validate-plan-apply@<VERSION>
+    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: <VERSION> # component version
+      opentofu_version: <OPENTOFU_VERSION>
+
+stages: [validate, test, build, deploy, cleanup]
+```
+
 (You may need to adjust the path to the `components/opentofu` to match your mirror.)
 Fore more details refer to the [Renovate documentation](https://docs.renovatebot.com/config-presets/).
 
diff --git a/.gitlab/release-notes.md.template b/.gitlab/release-notes.md.template
index 4841b70..6c23d93 100644
--- a/.gitlab/release-notes.md.template
+++ b/.gitlab/release-notes.md.template
@@ -17,7 +17,7 @@ include:
       # 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: $CI_COMMIT_TAG
+      version: $CI_COMMIT_TAG # component version
       opentofu_version: $LATEST_OPENTOFU_VERSION
 
 stages: [validate, test, build, deploy, cleanup]
diff --git a/README.md b/README.md
index 754a0b8..b4477fb 100644
--- a/README.md
+++ b/README.md
@@ -28,7 +28,7 @@ include:
       # 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: <VERSION>
+      version: <VERSION> # component version
       opentofu_version: <OPENTOFU_VERSION>
 
 stages: [validate, test, build, deploy, cleanup]
@@ -42,7 +42,7 @@ include:
       # 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: <VERSION>
+      version: <VERSION> # component version
       opentofu_version: <OPENTOFU_VERSION>
 
 stages: [validate, build, deploy]
@@ -58,7 +58,7 @@ include:
       # 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: 0.10.0
+      version: 0.10.0 # component version
       opentofu_version: 1.6.1
 
 stages: [validate, test, build, deploy, cleanup]
@@ -73,7 +73,7 @@ include:
       # 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
+      version: latest # component version
       opentofu_version: 1.6.1
 
 stages: [validate, test, build, deploy, cleanup]
@@ -88,7 +88,7 @@ include:
       # 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: <VERSION>
+      version: <VERSION> # component version
       opentofu_version: <OPENTOFU_VERSION>
 
 stages: [...]
@@ -384,6 +384,23 @@ so that the OpenTofu version is raised to a maximum of the version suitable for
   ...
 }
 ```
+
+The above renovate config allows to update the `version` input together with the component include
+version if the `version` input has a `# component version` comment suffix, like so:
+
+```yaml
+include:
+  - component: $CI_SERVER_FQDN/components/opentofu/validate-plan-apply@<VERSION>
+    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: <VERSION> # component version
+      opentofu_version: <OPENTOFU_VERSION>
+
+stages: [validate, test, build, deploy, cleanup]
+```
+
 (You may need to adjust the path to the `components/opentofu` to match your mirror.)
 Fore more details refer to the [Renovate documentation](https://docs.renovatebot.com/config-presets/).
 
-- 
GitLab