From 1155cc2342c86d7684f717df1ed35b1c14075458 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 88f02bc..20df480 100644
--- a/backports/OpenTofu/Base.latest.gitlab-ci.yml
+++ b/backports/OpenTofu/Base.latest.gitlab-ci.yml
@@ -59,7 +59,6 @@ variables:
     - 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: "$TF_ROOT"
diff --git a/templates/fmt.yml b/templates/fmt.yml
index 730f1a8..3736c72 100644
--- a/templates/fmt.yml
+++ b/templates/fmt.yml
@@ -40,11 +40,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.'
 
 ---
 
@@ -56,8 +55,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: "$[[ inputs.root_dir ]]"
     paths:
-- 
GitLab