Skip to content
Snippets Groups Projects
Commit d461090b authored by Tim Jaacks's avatar Tim Jaacks
Browse files

Remove hard coded project and branch variables

MANIFEST_PROJECT, MASTER_BRANCH_MANIFEST, MASTER_BRANCH_PROJECT
parent a4aae414
No related branches found
No related tags found
1 merge request!189Multiple integration pipelines
......@@ -84,7 +84,7 @@ workflow:
GITLAB_SERVER: "${CI_SERVER_HOST}:${CI_SERVER_SSH_PORT}"
GIT_BASE_URL: "ssh://git@${GITLAB_SERVER}/${CI_PROJECT_ROOT_NAMESPACE}"
TESTS_GIT_URL: "${GIT_BASE_URL}/yocto/tests.git"
TEST_REPO_BRANCH: ${MASTER_BRANCH_MANIFEST}
TEST_REPO_BRANCH: ${MASTER_BRANCH}
artifacts:
when: always
paths:
......
......@@ -21,7 +21,7 @@ stages:
- uploadftp
variables:
MASTER_BRANCH_MANIFEST: {{ MASTER_BRANCH_MANIFEST }}
MASTER_BRANCH: {{ MASTER_BRANCH }}
# --------------------------------------------------------------------------------------
# Stage: infrastructure
......@@ -30,7 +30,7 @@ changelog:
extends: .infrastructure
script: .gitlab-ci/scripts/changelog_generator.py
--token=${GITBOT_TOKEN}
--branch=${MASTER_BRANCH_MANIFEST}
--branch=${MASTER_BRANCH}
> changelog.md
artifacts:
expire_in: 4 weeks
......
......@@ -36,7 +36,7 @@ variables:
- if: $CI_PIPELINE_SOURCE == "parent_pipeline"
when: never
# Usually run this job only on non-master branches, i.e. in merge requests
- if: $CI_COMMIT_REF_NAME != $MASTER_BRANCH_MANIFEST
- if: $CI_COMMIT_REF_NAME != $MASTER_BRANCH
# Additionally run this job if pipeline was triggered by the API, which happens e.g.
# when no pipeline has run in a merge request, so a full build pipeline is needed on
# the master
......
......@@ -188,7 +188,6 @@ the git revision in the `SRCREV.conf` file on project changes.
2. Add an approriate `.gitlab-ci.yml` file. For example, copy it from the
repository [egalxi2c][8]. Modify the following variables in the file:
* `MASTER_BRANCH_PROJECT`: Set the project master branch
* `BB_RECIPE_NAME`: Set the name of the bitbake recipe
3. Create a corresponding entry in the `SRCREV.conf` file of the manifest repo:\
......
---
include:
- local: manifest-integration.yml
variables:
# FIXME: This variable is used in the manifest-integration's build stage for the
# trigger project. Due to a missing feature in GitLab, we cannot use any variables
# here and have to hard-code 'seco-ne' instead of using CI_PROJECT_ROOT_NAMESPACE.
# (https://gitlab.com/gitlab-org/gitlab/-/issues/249583)
MANIFEST_PROJECT: seco-ne/yocto/infrastructure/ci-test/minimal-manifest
# 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: master
MASTER_BRANCH_PROJECT: master
......@@ -40,9 +40,9 @@ integrate:
- .gitlab-ci/scripts/integrate_into_manifest.py
--gitlab-url=${CI_SERVER_URL}
--token=${GITBOT_TOKEN}
--manifest-project=${MANIFEST_PROJECT}
--manifest-project=${TARGET_PROJECT}
--manifest-file=${MANIFEST_FILE}
--integration-base=${MASTER_BRANCH_MANIFEST}
--integration-base=${TARGET_BRANCH}
--project=${CI_PROJECT_PATH}
--merge-request=${MERGE_REQUEST}
--save-revision-to=manifest_revision
......@@ -61,16 +61,16 @@ merge:
extends: .infrastructure
stage: merge
rules:
- if: $CI_COMMIT_BRANCH == $MASTER_BRANCH_PROJECT
- if: $CI_COMMIT_BRANCH == $SOURCE_BRANCH
script:
- cd ${CI_PROJECT_DIR}
- .gitlab-ci/scripts/merge_into_manifest.py
--gitlab-url=${CI_SERVER_URL}
--token=${GITBOT_TOKEN}
--manifest-project=${MANIFEST_PROJECT}
--master-branch=${MASTER_BRANCH_MANIFEST}
--manifest-project=${TARGET_PROJECT}
--master-branch=${TARGET_BRANCH}
--project=${CI_PROJECT_PATH}
--master-branch-project=${MASTER_BRANCH_PROJECT}
--master-branch-project=${SOURCE_BRANCH}
--commit=${CI_COMMIT_SHA}
--save-revision-to=manifest_revision
--recipe-name=${BB_RECIPE_NAME}
......@@ -90,9 +90,9 @@ build:
- if: $CI_MERGE_REQUEST_IID
trigger:
# FIXME: see FIXME comments in manifest-integration-pipelines.yml.jinja2
# project: $MANIFEST_PROJECT
# project: $TARGET_PROJECT
project: {{ TARGET_PROJECT }}
branch: "integrate/${CI_PROJECT_NAME}/${CI_COMMIT_REF_NAME}/into/${MASTER_BRANCH_MANIFEST}"
branch: "integrate/${CI_PROJECT_NAME}/${CI_COMMIT_REF_NAME}/into/${TARGET_BRANCH}"
strategy: depend
# --------------------------------------------------------------------------------------
......@@ -128,8 +128,8 @@ check:
- .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}
--manifest-project=${TARGET_PROJECT}
--integration-base=${TARGET_BRANCH}
--project=${CI_PROJECT_PATH}
--merge-request=${MERGE_REQUEST}
--verbose
......
......@@ -56,9 +56,9 @@ generate:
needs:
- generate
variables:
MASTER_BRANCH_PROJECT: {{ SOURCE_BRANCH }}
MANIFEST_PROJECT: {{ TARGET_PROJECT }}
MASTER_BRANCH_MANIFEST: {{ TARGET_BRANCH }}
SOURCE_BRANCH: {{ SOURCE_BRANCH }}
TARGET_PROJECT: {{ TARGET_PROJECT }}
TARGET_BRANCH: {{ TARGET_BRANCH }}
GITLAB_CI_REVISION: {{ GITLAB_CI_REVISION }}
MANIFEST_FILE: {{ MANIFEST_FILE }}
BB_RECIPE_NAME: {{ BB_RECIPE_NAME }}
......
---
include:
- local: manifest-integration.yml
variables:
# FIXME: This variable is used in the manifest-integration's build stage for the
# trigger project. Due to a missing feature in GitLab, we cannot use any variables
# here and have to hard-code 'seco-ne' instead of using CI_PROJECT_ROOT_NAMESPACE.
# (https://gitlab.com/gitlab-org/gitlab/-/issues/249583)
MANIFEST_PROJECT: seco-ne/yocto/manifest
# 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
......@@ -20,5 +20,4 @@ variables:
# 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: master
MASTER_BRANCH_PROJECT: master
MASTER_BRANCH: master
......@@ -33,7 +33,7 @@ workflow:
rules:
# Run the full build pipeline on non-master branches (i.e. in the merge request)
# or if explicitly triggered by the API or the web button.
- if: $CI_COMMIT_REF_NAME != $MASTER_BRANCH_MANIFEST
- if: $CI_COMMIT_REF_NAME != $MASTER_BRANCH
- if: $CI_PIPELINE_SOURCE == "api"
- if: $CI_PIPELINE_SOURCE == "pipeline"
- if: $CI_PIPELINE_SOURCE == "web"
......@@ -49,7 +49,7 @@ workflow:
when: never
- if: $CI_PIPELINE_SOURCE == "web"
when: never
- if: $CI_COMMIT_REF_NAME == $MASTER_BRANCH_MANIFEST
- if: $CI_COMMIT_REF_NAME == $MASTER_BRANCH
# --------------------------------------------------------------------------------------
# Stage: retrigger
......@@ -77,7 +77,7 @@ retrigger:
--token=${GITBOT_TOKEN}
--project=${PROJECT}
--state=opened
--target-branch=${MASTER_BRANCH_MANIFEST}
--target-branch=${MASTER_BRANCH}
--job=check
;
done
......@@ -137,7 +137,7 @@ build:merge_request:
--token=${GITBOT_TOKEN}
--project=${CI_PROJECT_PATH}
--commit=${CI_COMMIT_SHA}
--ref=^${MASTER_BRANCH_MANIFEST} || true | head -1)
--ref=^${MASTER_BRANCH} || true | head -1)
# If pipeline exists, mirror its result
- if [ ! -z "${MR_PIPELINE}" ]; then
.gitlab-ci/scripts/mirror_pipeline_result.py
......@@ -151,5 +151,5 @@ build:merge_request:
--gitlab-url=${CI_SERVER_URL}
--token=${GITBOT_TOKEN}
--project=${CI_PROJECT_PATH}
--ref=${MASTER_BRANCH_MANIFEST}
--ref=${MASTER_BRANCH}
- fi
......@@ -26,17 +26,12 @@ def read_keys_from_gitlab_ci_yml(gitlab_ci_yml):
data = yaml.load(gitlab_ci_yml)
logging.debug("Yaml: %s", data)
try:
masterbranch = data["variables"]["MASTER_BRANCH_PROJECT"]
logging.debug("Masterbranch %s", masterbranch)
except KeyError:
masterbranch = None
try:
recipe = data["variables"]["BB_RECIPE_NAME"]
logging.debug("Recipe %s", recipe)
except KeyError:
recipe = None
return {"recipe": recipe, "masterbranch": masterbranch}
return {"recipe": recipe}
def integrate_submodule_into(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment