From 8fc67dd19677249abd5a45821a82c17eb68f8aec Mon Sep 17 00:00:00 2001
From: Timo Furrer <tfurrer@gitlab.com>
Date: Mon, 10 Jun 2024 09:21:11 +0200
Subject: [PATCH] Actually update templates with version SSoT

---
 templates/apply.yml                 | 2 +-
 templates/custom-command.yml        | 2 +-
 templates/destroy.yml               | 2 +-
 templates/fmt.yml                   | 2 +-
 templates/full-pipeline.yml         | 2 +-
 templates/job-templates.yml         | 2 +-
 templates/plan.yml                  | 9 ++-------
 templates/test.yml                  | 2 +-
 templates/validate-plan-apply.yml   | 2 +-
 templates/validate-plan-destroy.yml | 2 +-
 templates/validate-plan.yml         | 2 +-
 templates/validate.yml              | 2 +-
 12 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/templates/apply.yml b/templates/apply.yml
index e2d3778..f57d7f9 100644
--- a/templates/apply.yml
+++ b/templates/apply.yml
@@ -18,13 +18,13 @@ spec:
     opentofu_version:
       default: '1.7.1'
       options:
-        - '$OPENTOFU_VERSION'
         - '1.7.1'
         - '1.7.0'
         - '1.7.0-alpha1'
         - '1.6.2'
         - '1.6.1'
         - '1.6.0'
+        - '$OPENTOFU_VERSION'
       description: 'OpenTofu version that should be used.'
 
     # Images
diff --git a/templates/custom-command.yml b/templates/custom-command.yml
index f1f9f90..b38a20c 100644
--- a/templates/custom-command.yml
+++ b/templates/custom-command.yml
@@ -18,13 +18,13 @@ spec:
     opentofu_version:
       default: '1.7.1'
       options:
-        - '$OPENTOFU_VERSION'
         - '1.7.1'
         - '1.7.0'
         - '1.7.0-alpha1'
         - '1.6.2'
         - '1.6.1'
         - '1.6.0'
+        - '$OPENTOFU_VERSION'
       description: 'OpenTofu version that should be used.'
 
     # Images
diff --git a/templates/destroy.yml b/templates/destroy.yml
index cd9a743..748ef28 100644
--- a/templates/destroy.yml
+++ b/templates/destroy.yml
@@ -18,13 +18,13 @@ spec:
     opentofu_version:
       default: '1.7.1'
       options:
-        - '$OPENTOFU_VERSION'
         - '1.7.1'
         - '1.7.0'
         - '1.7.0-alpha1'
         - '1.6.2'
         - '1.6.1'
         - '1.6.0'
+        - '$OPENTOFU_VERSION'
       description: 'OpenTofu version that should be used.'
 
     # Images
diff --git a/templates/fmt.yml b/templates/fmt.yml
index 57fa7b2..cb8d130 100644
--- a/templates/fmt.yml
+++ b/templates/fmt.yml
@@ -18,13 +18,13 @@ spec:
     opentofu_version:
       default: '1.7.1'
       options:
-        - '$OPENTOFU_VERSION'
         - '1.7.1'
         - '1.7.0'
         - '1.7.0-alpha1'
         - '1.6.2'
         - '1.6.1'
         - '1.6.0'
+        - '$OPENTOFU_VERSION'
       description: 'OpenTofu version that should be used.'
 
     # Images
diff --git a/templates/full-pipeline.yml b/templates/full-pipeline.yml
index f0e4dd4..5654671 100644
--- a/templates/full-pipeline.yml
+++ b/templates/full-pipeline.yml
@@ -27,13 +27,13 @@ spec:
     opentofu_version:
       default: '1.7.1'
       options:
-        - '$OPENTOFU_VERSION'
         - '1.7.1'
         - '1.7.0'
         - '1.7.0-alpha1'
         - '1.6.2'
         - '1.6.1'
         - '1.6.0'
+        - '$OPENTOFU_VERSION'
       description: 'OpenTofu version that should be used.'
 
     # Images
diff --git a/templates/job-templates.yml b/templates/job-templates.yml
index e6a0fe8..31338da 100644
--- a/templates/job-templates.yml
+++ b/templates/job-templates.yml
@@ -27,13 +27,13 @@ spec:
     opentofu_version:
       default: '1.7.1'
       options:
-        - '$OPENTOFU_VERSION'
         - '1.7.1'
         - '1.7.0'
         - '1.7.0-alpha1'
         - '1.6.2'
         - '1.6.1'
         - '1.6.0'
+        - '$OPENTOFU_VERSION'
       description: 'OpenTofu version that should be used.'
 
     # Images
diff --git a/templates/plan.yml b/templates/plan.yml
index 08d0110..58255d5 100644
--- a/templates/plan.yml
+++ b/templates/plan.yml
@@ -18,13 +18,13 @@ spec:
     opentofu_version:
       default: '1.7.1'
       options:
-        - '$OPENTOFU_VERSION'
         - '1.7.1'
         - '1.7.0'
         - '1.7.0-alpha1'
         - '1.6.2'
         - '1.6.1'
         - '1.6.0'
+        - '$OPENTOFU_VERSION'
       description: 'OpenTofu version that should be used.'
 
     # Images
@@ -97,11 +97,6 @@ spec:
   image:
     name: '$[[ inputs.image_registry_base ]]/$[[ inputs.image_name ]]:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]'
   script:
-    - |
-      args=""
-      if [ "$[[ inputs.destroy ]]" == "true" ]; then 
-        echo "Planning for a destroy"
-        args="-destroy"
-      fi
+    - "args=\"\"\nif [ \"$[[ inputs.destroy ]]\" == \"true\" ]; then \n  echo \"Planning for a destroy\"\n  args=\"-destroy\"\nfi\n"
     - gitlab-tofu plan $args
     - gitlab-tofu plan-json
diff --git a/templates/test.yml b/templates/test.yml
index 29767e4..8f65107 100644
--- a/templates/test.yml
+++ b/templates/test.yml
@@ -18,13 +18,13 @@ spec:
     opentofu_version:
       default: '1.7.1'
       options:
-        - '$OPENTOFU_VERSION'
         - '1.7.1'
         - '1.7.0'
         - '1.7.0-alpha1'
         - '1.6.2'
         - '1.6.1'
         - '1.6.0'
+        - '$OPENTOFU_VERSION'
       description: 'OpenTofu version that should be used.'
 
     # Images
diff --git a/templates/validate-plan-apply.yml b/templates/validate-plan-apply.yml
index 7608be9..258662b 100644
--- a/templates/validate-plan-apply.yml
+++ b/templates/validate-plan-apply.yml
@@ -21,13 +21,13 @@ spec:
     opentofu_version:
       default: '1.7.1'
       options:
-        - '$OPENTOFU_VERSION'
         - '1.7.1'
         - '1.7.0'
         - '1.7.0-alpha1'
         - '1.6.2'
         - '1.6.1'
         - '1.6.0'
+        - '$OPENTOFU_VERSION'
       description: 'OpenTofu version that should be used.'
 
     # Images
diff --git a/templates/validate-plan-destroy.yml b/templates/validate-plan-destroy.yml
index 35c51a9..60f2fb6 100644
--- a/templates/validate-plan-destroy.yml
+++ b/templates/validate-plan-destroy.yml
@@ -21,13 +21,13 @@ spec:
     opentofu_version:
       default: '1.7.1'
       options:
-        - '$OPENTOFU_VERSION'
         - '1.7.1'
         - '1.7.0'
         - '1.7.0-alpha1'
         - '1.6.2'
         - '1.6.1'
         - '1.6.0'
+        - '$OPENTOFU_VERSION'
       description: 'OpenTofu version that should be used.'
 
     # Images
diff --git a/templates/validate-plan.yml b/templates/validate-plan.yml
index 145e858..480f068 100644
--- a/templates/validate-plan.yml
+++ b/templates/validate-plan.yml
@@ -18,13 +18,13 @@ spec:
     opentofu_version:
       default: '1.7.1'
       options:
-        - '$OPENTOFU_VERSION'
         - '1.7.1'
         - '1.7.0'
         - '1.7.0-alpha1'
         - '1.6.2'
         - '1.6.1'
         - '1.6.0'
+        - '$OPENTOFU_VERSION'
       description: 'OpenTofu version that should be used.'
 
     # Images
diff --git a/templates/validate.yml b/templates/validate.yml
index 2b1b407..3be97a1 100644
--- a/templates/validate.yml
+++ b/templates/validate.yml
@@ -18,13 +18,13 @@ spec:
     opentofu_version:
       default: '1.7.1'
       options:
-        - '$OPENTOFU_VERSION'
         - '1.7.1'
         - '1.7.0'
         - '1.7.0-alpha1'
         - '1.6.2'
         - '1.6.1'
         - '1.6.0'
+        - '$OPENTOFU_VERSION'
       description: 'OpenTofu version that should be used.'
 
     # Images
-- 
GitLab