diff --git a/ci-test-manifest-integration.yml b/ci-test-manifest-integration.yml index fa5e7628e9c5a8478a1d38fd74709f2209f7d9f1..f6081fff490e008962dd29b1ec7f3bde2fb1038f 100644 --- a/ci-test-manifest-integration.yml +++ b/ci-test-manifest-integration.yml @@ -1,13 +1,10 @@ --- -# ------------------------------------------------------------------------------------- -# CI steps needed to integrate a sub project change into the manifest project -# foobar variant which is used for testing the CI -# ------------------------------------------------------------------------------------- +# --------------------------------------------------------------------------------------- +# Global +# --------------------------------------------------------------------------------------- include: - local: common.yml -image: "${CI_IMAGE_PYTHON}" - stages: - infrastructure - integrate @@ -113,7 +110,6 @@ merge: --commit=${CI_COMMIT_SHA} --save-revision-to=manifest_revision --recipe-name=${BB_RECIPE_NAME} - --verbose artifacts: paths: - manifest_revision @@ -140,4 +136,44 @@ build: # Stage: check # -------------------------------------------------------------------------------------- check: - extends: .check + extends: .infrastructure + stage: check + rules: + # Do not run check if the "skip build" label is set on the merge request + - if: $CI_MERGE_REQUEST_LABELS =~ /skip build/ + when: never + # Do not integration pipeline for merge requests for integrate/gitlab-ci/ branches + # The integration is done from the pipeline in gitlab-ci already + - if: $CI_COMMIT_REF_NAME =~ /^integrate\/gitlab-ci\/.*/ + when: never + - if: $CI_MERGE_REQUEST_IID + # Explicitly allow externally triggered pipelines in every case + - if: $CI_PIPELINE_SOURCE == "pipeline" || $CI_PIPELINE_SOURCE == "api" + needs: ["integrate"] + allow_failure: true + script: + - cd ${CI_PROJECT_DIR} + # When running in a trigger pipeline the CII_MERGE_REQUEST_IID is not set + # but CI_OPEN_MERGE_REQUESTS. We use the first of this comma separated list + # in this case + - if [ -n "${CI_MERGE_REQUEST_IID}" ];then + MERGE_REQUEST="${CI_MERGE_REQUEST_IID}"; + else + MERGE_REQUEST="${CI_OPEN_MERGE_REQUESTS%%,*}"; + fi + # The 'parent_merge_request' is passed from the trigger + # in case this check job is part of a gitlab-ci integration + # pipeline. It is only used to display the correct MR to run again + # in a failed check + - if [ -n "${parent_merge_request}" ];then + PARENT_MR="--parent-merge-request=${parent_merge_request}"; + fi + - .gitlab-ci/scripts/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=${MERGE_REQUEST} + --verbose + ${PARENT_MR} diff --git a/common.yml b/common.yml index 186a45336d0ad491c27fafc64d38b8803ac53877..a563d4eff3252780d2b1f8a439a72b30cd80c6bd 100644 --- a/common.yml +++ b/common.yml @@ -13,14 +13,6 @@ variables: # Reduced depth as checkout of larger projects (like the kernel) # may take too long GIT_DEPTH: 1 - # FIXME: due to a missing feature in GitLab we cannot use this variable - # in the build stage further down this file. If it ever changes, it has - # to be changed there too. - # (https://gitlab.com/gitlab-org/gitlab/-/issues/249583) - MANIFEST_PROJECT: ${CI_PROJECT_ROOT_NAMESPACE}/yocto/manifest - - MASTER_BRANCH_MANIFEST: dunfell - MASTER_BRANCH_PROJECT: dunfell DEPLOYPATH_TEST: "/artifacts/${CI_JOB_ID}/" GITLAB_SERVER: "${CI_SERVER_HOST}:${CI_SERVER_SSH_PORT}" @@ -52,49 +44,3 @@ yamllint: - if: $CI_COMMIT_REF_NAME != $MASTER_BRANCH_MANIFEST || $CI_PIPELINE_SOURCE == "api" script: - yamllint -c .gitlab-ci/.yamllint.yml .*.yml - -# -------------------------------------------------------------------------------------- -# Common check job, used in yocto and foobar manifest-integration projects -# -------------------------------------------------------------------------------------- -.check: - extends: .infrastructure - stage: check - rules: - # Do not run check if the "skip build" label is set on the merge request - - if: $CI_MERGE_REQUEST_LABELS =~ /skip build/ - when: never - # Do not integration pipeline for merge requests for integrate/gitlab-ci/ branches - # The integration is done from the pipeline in gitlab-ci already - - if: $CI_COMMIT_REF_NAME =~ /^integrate\/gitlab-ci\/.*/ - when: never - - if: $CI_MERGE_REQUEST_IID - # Explicitly allow externally triggered pipelines in every case - - if: $CI_PIPELINE_SOURCE == "pipeline" || $CI_PIPELINE_SOURCE == "api" - needs: ["integrate"] - allow_failure: true - script: - - cd ${CI_PROJECT_DIR} - # When running in a trigger pipeline the CII_MERGE_REQUEST_IID is not set - # but CI_OPEN_MERGE_REQUESTS. We use the first of this comma separated list - # in this case - - if [ -n "${CI_MERGE_REQUEST_IID}" ];then - MERGE_REQUEST="${CI_MERGE_REQUEST_IID}"; - else - MERGE_REQUEST="${CI_OPEN_MERGE_REQUESTS%%,*}"; - fi - # The 'parent_merge_request' is passed from the trigger - # in case this check job is part of a gitlab-ci integration - # pipeline. It is only used to display the correct MR to run again - # in a failed check - - if [ -n "${parent_merge_request}" ];then - PARENT_MR="--parent-merge-request=${parent_merge_request}"; - fi - - .gitlab-ci/scripts/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=${MERGE_REQUEST} - --verbose - ${PARENT_MR} diff --git a/manifest-integration.yml b/manifest-integration.yml index e3670a2676543429f357c711d3601b54213b2fd0..8349ded5bbeefafcef687613992bd2ff34ebb266 100644 --- a/manifest-integration.yml +++ b/manifest-integration.yml @@ -13,6 +13,16 @@ stages: - check variables: + # FIXME: due to a missing feature in GitLab, we cannot use this variable in the build + # stage further down this file. If it ever changes, it has to be changed there too. + # (https://gitlab.com/gitlab-org/gitlab/-/issues/249583) + MANIFEST_PROJECT: "${CI_PROJECT_ROOT_NAMESPACE}/yocto/manifest" + MANIFEST_FILE: "default.xml" + # The master branch is hardcoded here, because it cannot be determined automatically. + # Has to be modified for new branches, e.g. new Yocto versions or fix releases. + MASTER_BRANCH_MANIFEST: dunfell + MASTER_BRANCH_PROJECT: dunfell + # The BB_RECIPE_NAME is used for projects referenced in the SRCREV file # to match the repository and the bitbake recipe name. # We set it here to none, as every project needing it @@ -20,7 +30,6 @@ variables: # The BB_RECIPE_NAME is passed to the python scripts below anyway, but not # used for projects referenced in the manifest file. BB_RECIPE_NAME: none - MANIFEST_FILE: "default.xml" workflow: rules: @@ -126,4 +135,44 @@ build: # Stage: check # -------------------------------------------------------------------------------------- check: - extends: .check + extends: .infrastructure + stage: check + rules: + # Do not run check if the "skip build" label is set on the merge request + - if: $CI_MERGE_REQUEST_LABELS =~ /skip build/ + when: never + # Do not integration pipeline for merge requests for integrate/gitlab-ci/ branches + # The integration is done from the pipeline in gitlab-ci already + - if: $CI_COMMIT_REF_NAME =~ /^integrate\/gitlab-ci\/.*/ + when: never + - if: $CI_MERGE_REQUEST_IID + # Explicitly allow externally triggered pipelines in every case + - if: $CI_PIPELINE_SOURCE == "pipeline" || $CI_PIPELINE_SOURCE == "api" + needs: ["integrate"] + allow_failure: true + script: + - cd ${CI_PROJECT_DIR} + # When running in a trigger pipeline the CII_MERGE_REQUEST_IID is not set + # but CI_OPEN_MERGE_REQUESTS. We use the first of this comma separated list + # in this case + - if [ -n "${CI_MERGE_REQUEST_IID}" ];then + MERGE_REQUEST="${CI_MERGE_REQUEST_IID}"; + else + MERGE_REQUEST="${CI_OPEN_MERGE_REQUESTS%%,*}"; + fi + # The 'parent_merge_request' is passed from the trigger + # in case this check job is part of a gitlab-ci integration + # pipeline. It is only used to display the correct MR to run again + # in a failed check + - if [ -n "${parent_merge_request}" ];then + PARENT_MR="--parent-merge-request=${parent_merge_request}"; + fi + - .gitlab-ci/scripts/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=${MERGE_REQUEST} + --verbose + ${PARENT_MR}