From 7f68f3070c9732bd3df575f88e0e66971e068b09 Mon Sep 17 00:00:00 2001
From: Tim Jaacks <tim.jaacks@garz-fricke.com>
Date: Tue, 21 Jun 2022 11:23:40 +0200
Subject: [PATCH] Yocto manifest build: re-enable build:merge_request job

This job was accidentally disabled in 2e6c1b4, because it was included
in the generated child pipeline. This pipeline is not created on the
master, though, so the condition for the job was never met.

Move the job to the parent pipeline again, so that it gets executed on
the master like before.
---
 manifest-build.yml | 31 -------------------------------
 manifest.yml       | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 31 deletions(-)

diff --git a/manifest-build.yml b/manifest-build.yml
index 6a4381cf..d3d7e7c8 100644
--- a/manifest-build.yml
+++ b/manifest-build.yml
@@ -167,37 +167,6 @@ variables:
     CI_PARAM_IMAGE: ${CI_PARAM_IMAGE_FNG}
     CI_PARAM_DISTRO: ${CI_PARAM_DISTRO_FNG}
 
-build:merge_request:
-  extends: .infrastructure
-  stage: build
-  timeout: 1h
-  rules:
-    - if: $CI_COMMIT_REF_NAME == $MASTER_BRANCH_MANIFEST && $CI_PIPELINE_SOURCE != "api"
-  script:
-    - cd ${CI_PROJECT_DIR}
-    # Get pipeline for merge request
-    - MR_PIPELINE=$(.gitlab-ci/scripts/get_pipelines.py
-        --gitlab-url=${CI_SERVER_URL}
-        --token=${GITBOT_TOKEN}
-        --project=${CI_PROJECT_PATH}
-        --commit=${CI_COMMIT_SHA}
-        --ref=^${MASTER_BRANCH_MANIFEST} || true | head -1)
-    # If pipeline exists, mirror its result
-    - if [ ! -z "${MR_PIPELINE}" ]; then
-        .gitlab-ci/scripts/mirror_pipeline_result.py
-          --gitlab-url=${CI_SERVER_URL}
-          --token=${GITBOT_TOKEN}
-          --project=${CI_PROJECT_PATH}
-          --pipeline=${MR_PIPELINE}
-    # If no pipeline found, trigger a new one on the master
-    - else
-        .gitlab-ci/scripts/trigger_pipeline.py
-          --gitlab-url=${CI_SERVER_URL}
-          --token=${GITBOT_TOKEN}
-          --project=${CI_PROJECT_PATH}
-          --ref=${MASTER_BRANCH_MANIFEST}
-    - fi
-
 .buildsdk:
   extends:
     - .buildimage
diff --git a/manifest.yml b/manifest.yml
index 2aa68099..5cfad0a1 100644
--- a/manifest.yml
+++ b/manifest.yml
@@ -8,6 +8,7 @@ include:
 stages:
   - retrigger
   - infrastructure
+  - build
 
 variables:
   # Default image and distro
@@ -118,3 +119,37 @@ trigger-build-jobs:
 
 yamllint:
   extends: .yamllint
+
+# --------------------------------------------------------------------------------------
+# Stage: build
+# --------------------------------------------------------------------------------------
+build:merge_request:
+  extends: .infrastructure
+  stage: build
+  timeout: 1h
+  rules:
+    - if: $CI_COMMIT_REF_NAME == $MASTER_BRANCH_MANIFEST && $CI_PIPELINE_SOURCE != "api"
+  script:
+    - cd ${CI_PROJECT_DIR}
+    # Get pipeline for merge request
+    - MR_PIPELINE=$(.gitlab-ci/scripts/get_pipelines.py
+        --gitlab-url=${CI_SERVER_URL}
+        --token=${GITBOT_TOKEN}
+        --project=${CI_PROJECT_PATH}
+        --commit=${CI_COMMIT_SHA}
+        --ref=^${MASTER_BRANCH_MANIFEST} || true | head -1)
+    # If pipeline exists, mirror its result
+    - if [ ! -z "${MR_PIPELINE}" ]; then
+        .gitlab-ci/scripts/mirror_pipeline_result.py
+          --gitlab-url=${CI_SERVER_URL}
+          --token=${GITBOT_TOKEN}
+          --project=${CI_PROJECT_PATH}
+          --pipeline=${MR_PIPELINE}
+    # If no pipeline found, trigger a new one on the master
+    - else
+        .gitlab-ci/scripts/trigger_pipeline.py
+          --gitlab-url=${CI_SERVER_URL}
+          --token=${GITBOT_TOKEN}
+          --project=${CI_PROJECT_PATH}
+          --ref=${MASTER_BRANCH_MANIFEST}
+    - fi
-- 
GitLab