From 56b4cacb6f2a62b0dc325275585fe6673d453ba3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20H=C3=B6ppner?= <jonas.hoeppner@garz-fricke.com> Date: Mon, 21 Mar 2022 15:51:29 +0100 Subject: [PATCH] CI: Adapt manifests-integration.yml and manifest.yml for yocto projects Integrates the changes done in the foobar- yml files to the yocto projects. --- manifest-integration.yml | 38 +++++++++++++++++++++++++++++++++++--- manifest.yml | 5 ++--- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/manifest-integration.yml b/manifest-integration.yml index 6ead7050..736d10e5 100644 --- a/manifest-integration.yml +++ b/manifest-integration.yml @@ -36,6 +36,12 @@ variables: workflow: rules: + # Explicitly allow externally triggered pipelines in every case + - if: $CI_PIPELINE_SOURCE == "pipeline" || $CI_PIPELINE_SOURCE == "api" + # Do not run pipelines for merge requests for integrate/gitlab-ci/ branches + # These are trigger explicitly from the integration pipeline in gitlab-ci repo + - if: $CI_COMMIT_REF_NAME =~ /^integrate\/gitlab-ci\/.*/ + when: never # Do not run pipelines on forked projects. # The pipelines would not work anyway because of the users permissions. # There are two cases catched here: @@ -73,6 +79,8 @@ integrate: # master at the time a merge request is created. Otherwise we cannot # guarantee a green master after merging. - if: $CI_MERGE_REQUEST_IID + # Explicitly allow externally triggered pipelines in every case + - if: $CI_PIPELINE_SOURCE == "pipeline" || $CI_PIPELINE_SOURCE == "api" tags: - infrastructure timeout: 5m @@ -80,15 +88,21 @@ integrate: policy: push script: - cd ${CI_PROJECT_DIR} + - if [ -n "${CI_MERGE_REQUEST_IID}" ];then + MERGE_REQUEST="${CI_MERGE_REQUEST_IID}"; + else + MERGE_REQUEST="${CI_OPEN_MERGE_REQUESTS%%,*}"; + fi - .gitlab-ci/integrate_into_manifest.py --gitlab-url=${CI_SERVER_URL} --token=${GITBOT_TOKEN} --manifest-project=${MANIFEST_PROJECT} --integration-base=${MASTER_BRANCH_MANIFEST} --project=${CI_PROJECT_PATH} - --merge-request=${CI_MERGE_REQUEST_IID} + --merge-request=${MERGE_REQUEST} --save-revision-to=manifest_revision --recipe-name=${BB_RECIPE_NAME} + --verbose artifacts: paths: - manifest_revision @@ -125,7 +139,10 @@ merge: build: stage: build rules: - - if: $CI_MERGE_REQUEST_IID + # execute this in MR only and not for integrate/gitlab-ci/ integrations + # branches. These are build after the integration has been done in all + # projects + - if: $CI_MERGE_REQUEST_IID && $CI_COMMIT_REF_NAME !~ /^integrate\/gitlab-ci\/.*/ trigger: project: SECO-Northern-Europe/yocto/manifest branch: "integrate/${CI_PROJECT_NAME}/${CI_COMMIT_REF_NAME}" @@ -138,16 +155,31 @@ check: stage: check rules: - if: $CI_MERGE_REQUEST_IID + # Explicitly allow externally triggered pipelines in every case + - if: $CI_PIPELINE_SOURCE == "pipeline" || $CI_PIPELINE_SOURCE == "api" needs: ["integrate"] tags: - infrastructure timeout: 5m script: - cd ${CI_PROJECT_DIR} + - if [ -n "${CI_MERGE_REQUEST_IID}" ];then + MERGE_REQUEST="${CI_MERGE_REQUEST_IID}"; + else + MERGE_REQUEST="${CI_OPEN_MERGE_REQUESTS%%,*}"; + fi + - if [ -n "${parent_merge_request}" ];then + PARENT_MR="--parent-merge-request=${parent_merge_request}"; + fi + - echo "${parent_merge_request}" + - echo "${PARENT_MR}" + - echo "${MERGE_REQUEST}" - .gitlab-ci/check_if_integration_branch_is_up_to_date.py --gitlab-url=${CI_SERVER_URL} --token=${GITBOT_TOKEN} --manifest-project=${MANIFEST_PROJECT} --integration-base=${MASTER_BRANCH_MANIFEST} --project=${CI_PROJECT_PATH} - --merge-request=${CI_MERGE_REQUEST_IID} + --merge-request=${MERGE_REQUEST} + --verbose + ${PARENT_MR} diff --git a/manifest.yml b/manifest.yml index e06e6f04..59ec32b9 100644 --- a/manifest.yml +++ b/manifest.yml @@ -38,9 +38,8 @@ workflow: # (use id instead of name because of rename) - if: $CI_PROJECT_ID != "17852514" when: never - # Do not run pipelines on integration branches, except from gitlab-ci repo - - if: $CI_COMMIT_REF_NAME =~ /^integrate\/.*/ && - $CI_COMMIT_REF_NAME !~ /^integrate\/gitlab-ci\/.*/ + # Do not run pipelines on integration branches + - if: $CI_COMMIT_REF_NAME =~ /^integrate\/.*/ when: never # In all other cases, run the pipeline automatically - when: always -- GitLab