From 0bf3b35abc7875672dffe2e6321ffd559f09efe1 Mon Sep 17 00:00:00 2001
From: Timo Furrer <tfurrer@gitlab.com>
Date: Fri, 26 Jan 2024 15:40:45 +0100
Subject: [PATCH] Do not recommend latest, but explicit version

---
 .gitlab/README.md.template                   | 19 ++++++++++---------
 README.md                                    | 19 ++++++++++---------
 backports/.Base.latest.gitlab-ci.yml         |  4 ++--
 backports/OpenTofu/Base.latest.gitlab-ci.yml |  4 ++--
 4 files changed, 24 insertions(+), 22 deletions(-)

diff --git a/.gitlab/README.md.template b/.gitlab/README.md.template
index b011690..2dcca1d 100644
--- a/.gitlab/README.md.template
+++ b/.gitlab/README.md.template
@@ -41,28 +41,29 @@ stages: [validate, build, deploy, cleanup]
 A concrete example may look like this:
 
 ```yaml
-# Using `latest`
+# Using version `0.10.0`:
 include:
-  - component: gitlab.com/components/opentofu/full-pipeline@~latest
+  - component: gitlab.com/components/opentofu/full-pipeline@0.10.0
     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
+      version: 0.10.0
       opentofu_version: 1.6.1
 
 stages: [validate, build, deploy, cleanup]
 
 ---
 
-# ... or using `0.0.0-alpha1`:
+# ... in case you absolutely know what you are doing and are
+# aware that this may introduce breaking changes, you may use the latest release:
 include:
-  - component: gitlab.com/components/opentofu/full-pipeline@0.0.0-alpha1
+  - 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
       # once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved.
-      version: 0.0.0-alpha1
+      version: latest
       opentofu_version: 1.6.1
 
 stages: [validate, build, deploy, cleanup]
@@ -85,12 +86,12 @@ 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
+  - component: gitlab.com/components/opentofu/fmt@<VERSON>
     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
+      version: <VERSION>
       opentofu_version: 1.6.1
       root_dir: tofu/
 ```
@@ -163,7 +164,7 @@ and then use the component as you would from GitLab.com, but change the domain,
 
 ```yaml
 include:
-  - component: gitlab.example.com/components/opentofu/full-pipeline@~latest
+  - component: gitlab.example.com/components/opentofu/full-pipeline@<VERSION>
     inputs:
       ...
 ```
diff --git a/README.md b/README.md
index 3bc88ef..cf06026 100644
--- a/README.md
+++ b/README.md
@@ -43,28 +43,29 @@ stages: [validate, build, deploy, cleanup]
 A concrete example may look like this:
 
 ```yaml
-# Using `latest`
+# Using version `0.10.0`:
 include:
-  - component: gitlab.com/components/opentofu/full-pipeline@~latest
+  - component: gitlab.com/components/opentofu/full-pipeline@0.10.0
     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
+      version: 0.10.0
       opentofu_version: 1.6.1
 
 stages: [validate, build, deploy, cleanup]
 
 ---
 
-# ... or using `0.0.0-alpha1`:
+# ... in case you absolutely know what you are doing and are
+# aware that this may introduce breaking changes, you may use the latest release:
 include:
-  - component: gitlab.com/components/opentofu/full-pipeline@0.0.0-alpha1
+  - 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
       # once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved.
-      version: 0.0.0-alpha1
+      version: latest
       opentofu_version: 1.6.1
 
 stages: [validate, build, deploy, cleanup]
@@ -87,12 +88,12 @@ 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
+  - component: gitlab.com/components/opentofu/fmt@<VERSON>
     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
+      version: <VERSION>
       opentofu_version: 1.6.1
       root_dir: tofu/
 ```
@@ -182,7 +183,7 @@ and then use the component as you would from GitLab.com, but change the domain,
 
 ```yaml
 include:
-  - component: gitlab.example.com/components/opentofu/full-pipeline@~latest
+  - component: gitlab.example.com/components/opentofu/full-pipeline@<VERSION>
     inputs:
       ...
 ```
diff --git a/backports/.Base.latest.gitlab-ci.yml b/backports/.Base.latest.gitlab-ci.yml
index 70d7a0e..5e7066f 100644
--- a/backports/.Base.latest.gitlab-ci.yml
+++ b/backports/.Base.latest.gitlab-ci.yml
@@ -40,9 +40,9 @@ opentofu:use-component-instead-of-template:
       echo "The OpenTofu CI/CD component with a default configuration can be included as follows:"
       echo " "
       echo "include:"
-      echo "  - component: gitlab.com/components/opentofu/full-pipeline@~latest"
+      echo "  - component: gitlab.com/components/opentofu/full-pipeline@<VERSION>"
       echo "    inputs:"
-      echo "      version: latest"
+      echo "      version: <VERSION>"
       echo "      opentofu_version: 1.6.0"
       echo ""
       echo "stages: [validate, build, deploy, cleanup]"
diff --git a/backports/OpenTofu/Base.latest.gitlab-ci.yml b/backports/OpenTofu/Base.latest.gitlab-ci.yml
index 2672ebe..4e978fc 100644
--- a/backports/OpenTofu/Base.latest.gitlab-ci.yml
+++ b/backports/OpenTofu/Base.latest.gitlab-ci.yml
@@ -40,9 +40,9 @@ opentofu:use-component-instead-of-template:
       echo "The OpenTofu CI/CD component with a default configuration can be included as follows:"
       echo " "
       echo "include:"
-      echo "  - component: gitlab.com/components/opentofu/full-pipeline@~latest"
+      echo "  - component: gitlab.com/components/opentofu/full-pipeline@<VERSION>"
       echo "    inputs:"
-      echo "      version: latest"
+      echo "      version: <VERSION>"
       echo "      opentofu_version: 1.6.0"
       echo ""
       echo "stages: [validate, build, deploy, cleanup]"
-- 
GitLab