From b026d8263d30b2966f1c6d74bc135d33854f2ffe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Laurent=20P=C3=A9tr=C3=A9?= <laurent.petre@cern.ch>
Date: Tue, 7 Nov 2023 19:23:55 +0100
Subject: [PATCH] Run deployment jobs only in the parent project

Deployment jobs systematically - and expectedly - fail in the forked
projects, leading to confusing CI errors for the end user. Avoid the
confusion.
---
 .gitlab-ci.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 607022f..a845b74 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -69,7 +69,7 @@ deploy preview:
     - .deploy eos
   stage: deploy
   rules:
-    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
+    - if: $CI_PROJECT_NAMESPACE == 'cmsgemonline/gem-ops' && $CI_PIPELINE_SOURCE == 'merge_request_event'
   environment:
     name: preview-$CI_MERGE_REQUEST_IID
     url: https://cmsgemonline.web.cern.ch/doc/preview-$CI_MERGE_REQUEST_IID
@@ -83,7 +83,7 @@ deploy preview:stop:
   extends: .deploy eos:stop
   stage: deploy
   rules:
-    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
+    - if: $CI_PROJECT_NAMESPACE == 'cmsgemonline/gem-ops' && $CI_PIPELINE_SOURCE == 'merge_request_event'
       when: manual
       allow_failure: true
   environment:
-- 
GitLab