From 4629e8a66896e2333e9ea45b7a1f7938a2318217 Mon Sep 17 00:00:00 2001
From: Jennifer Li <jli@gitlab.com>
Date: Tue, 11 Mar 2025 14:16:06 -0700
Subject: [PATCH] Run graphql job with custom exit code

---
 .gitlab/ci/frontend.gitlab-ci.yml |  6 +++---
 .gitlab/ci/graphql.gitlab-ci.yml  | 14 ++++++++++----
 .gitlab/ci/setup.gitlab-ci.yml    |  2 +-
 3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/.gitlab/ci/frontend.gitlab-ci.yml b/.gitlab/ci/frontend.gitlab-ci.yml
index 27b35cbe6fde7..08cbc900369d4 100644
--- a/.gitlab/ci/frontend.gitlab-ci.yml
+++ b/.gitlab/ci/frontend.gitlab-ci.yml
@@ -176,7 +176,7 @@ retrieve-frontend-fixtures:
         exit 0
       fi
     - !reference [.base-script, script]
-    - rspec_parallelized_job
+    - run_with_custom_exit_code rspec_parallelized_job
   artifacts:
     name: frontend-fixtures
     expire_in: 31d
@@ -236,7 +236,7 @@ graphql-schema-dump:
   stage: fixtures
   needs: []
   script:
-    - bundle exec rake gitlab:graphql:schema:dump
+    - run_with_custom_exit_code bundle exec rake gitlab:graphql:schema:dump
   artifacts:
     expire_in: 30 days
     name: graphql-schema
@@ -256,7 +256,7 @@ upload-graphql-schema-dump:
     - .with-graphql-schema-dump-needs
   script:
     - source scripts/gitlab_component_helpers.sh
-    - create_and_upload_graphql_schema_package
+    - run_with_custom_exit_code create_and_upload_graphql_schema_package
 
 
 .frontend-test-base:
diff --git a/.gitlab/ci/graphql.gitlab-ci.yml b/.gitlab/ci/graphql.gitlab-ci.yml
index c8066cc52eb5e..71d814024602b 100644
--- a/.gitlab/ci/graphql.gitlab-ci.yml
+++ b/.gitlab/ci/graphql.gitlab-ci.yml
@@ -9,10 +9,16 @@ graphql-verify:
   stage: test
   needs: []
   script:
-    - bundle exec rake gitlab:graphql:validate
-    - bundle exec rake gitlab:graphql:check_docs
-    - bundle exec rake gitlab:graphql:schema:dump
-    - node scripts/frontend/graphql_possible_types_extraction.js --check
+    - |
+      function graphql_verify() {
+        bundle exec rake gitlab:graphql:validate
+        bundle exec rake gitlab:graphql:check_docs
+        bundle exec rake gitlab:graphql:schema:dump
+        node scripts/frontend/graphql_possible_types_extraction.js --check
+      }
+
+      run_with_custom_exit_code graphql_verify
+
   artifacts:
     expire_in: 7 days
     name: graphql-schema-verify
diff --git a/.gitlab/ci/setup.gitlab-ci.yml b/.gitlab/ci/setup.gitlab-ci.yml
index 4cb8e3b95852b..8ec1bfc94edb7 100644
--- a/.gitlab/ci/setup.gitlab-ci.yml
+++ b/.gitlab/ci/setup.gitlab-ci.yml
@@ -119,7 +119,7 @@ generate-frontend-fixtures-mapping:
     - source ./scripts/rspec_helpers.sh
     - section_start "gitaly-test-spawn" "Spawning Gitaly"; scripts/gitaly-test-spawn; section_end "gitaly-test-spawn";  # Do not use 'bundle exec' here
   script:
-    - generate_frontend_fixtures_mapping
+    - run_with_custom_exit_code generate_frontend_fixtures_mapping
   artifacts:
     expire_in: 7d
     paths:
-- 
GitLab