From ad8a01368157d4cc0c02da2577454c2100a88786 Mon Sep 17 00:00:00 2001
From: Timo Furrer <tfurrer@gitlab.com>
Date: Fri, 26 Jan 2024 13:42:33 +0100
Subject: [PATCH] Support allow_failure input for fmt job

---
 backports/OpenTofu/Base.latest.gitlab-ci.yml |  1 -
 templates/fmt.yml                            | 12 +++++-------
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/backports/OpenTofu/Base.latest.gitlab-ci.yml b/backports/OpenTofu/Base.latest.gitlab-ci.yml
index 0c29988..16437e6 100644
--- a/backports/OpenTofu/Base.latest.gitlab-ci.yml
+++ b/backports/OpenTofu/Base.latest.gitlab-ci.yml
@@ -61,7 +61,6 @@ opentofu:use-component-instead-of-template:
     - if: $CI_OPEN_MERGE_REQUESTS  # Don't add it to a *branch* pipeline if it's already in a merge request pipeline.
       when: never
     - if: $CI_COMMIT_BRANCH        # If there's no open merge request, add it to a *branch* pipeline instead.
-  #allow_failure: true
   allow_failure: true
   cache:
     key: "$__CACHE_KEY_HACK"
diff --git a/templates/fmt.yml b/templates/fmt.yml
index e139f92..a1acee8 100644
--- a/templates/fmt.yml
+++ b/templates/fmt.yml
@@ -45,11 +45,10 @@ spec:
       default: ${CI_PROJECT_DIR}
       description: 'Root directory for the OpenTofu project.'
 
-    # FIXME: wait for https://gitlab.com/gitlab-org/gitlab/-/merge_requests/142009
-    # allow_failure:
-    #   default: true
-    #   type: boolean
-    #   description: 'If the job is allowed to fail or not.'
+    allow_failure:
+      default: true
+      type: boolean
+      description: 'If the job is allowed to fail or not.'
 
 ---
 
@@ -61,8 +60,7 @@ spec:
     - if: $CI_OPEN_MERGE_REQUESTS  # Don't add it to a *branch* pipeline if it's already in a merge request pipeline.
       when: never
     - if: $CI_COMMIT_BRANCH        # If there's no open merge request, add it to a *branch* pipeline instead.
-  #allow_failure: $[[ inputs.allow_failure ]]
-  allow_failure: true
+  allow_failure: $[[ inputs.allow_failure ]]
   cache:
     key: "$__CACHE_KEY_HACK"
     paths:
-- 
GitLab