From dfc6204abcdfce7f7ee51ee2127500f8aecfaafa Mon Sep 17 00:00:00 2001
From: Tim Jaacks <tim.jaacks@garz-fricke.com>
Date: Fri, 17 Dec 2021 20:02:46 +0100
Subject: [PATCH] deploy_gitlab_ci: trigger pipeline on integration branch

---
 deploy_gitlab_ci.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/deploy_gitlab_ci.py b/deploy_gitlab_ci.py
index ec5bb677..e46d601c 100755
--- a/deploy_gitlab_ci.py
+++ b/deploy_gitlab_ci.py
@@ -3,7 +3,7 @@ import common
 
 import argparse
 import sys
-from gitlab import Gitlab
+from gitlab import Gitlab, GitlabCreateError
 from accept_merge_request import accept_merge_request
 from create_merge_request import create_merge_request
 from get_merge_requests import get_merge_requests
@@ -91,6 +91,13 @@ def main():
     else:
         print("Existing integration merge request:\n%s" % mr.web_url)
 
+    # Explicitly trigger a pipeline on the integration branch (automatic pipelines are
+    # disabled for integration merge requests)
+    try:
+        project.pipelines.create({"ref": integration_branch})
+    except GitlabCreateError as e:
+        sys.exit("ERROR: could not create merge request pipeline: %s" % e)
+
     if not args.merge:
         print(
             "Skipping automatic merge in MR context. If you like to extend the "
-- 
GitLab