From 4ac376752f6dd4f85eb152cface018be5cc5543e Mon Sep 17 00:00:00 2001 From: Tim Jaacks <tim.jaacks@garz-fricke.com> Date: Mon, 29 Aug 2022 11:44:39 +0200 Subject: [PATCH] deploy_gitlab_ci: explicitly pass gitlab-ci project and branch --- .gitlab-ci.yml | 2 +- scripts/deploy_gitlab_ci.py | 32 ++++++++++++++++++-------------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 83311375..048c6e54 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -185,7 +185,7 @@ build-yocto:kirkstone: when: manual allow_failure: true variables: - MERGE: --merge + MERGE: --merge --project=${CI_PROJECT_PATH} --branch=${CI_COMMIT_REF_NAME} merge-ci-test: extends: diff --git a/scripts/deploy_gitlab_ci.py b/scripts/deploy_gitlab_ci.py index eac312ee..fb5a48dd 100755 --- a/scripts/deploy_gitlab_ci.py +++ b/scripts/deploy_gitlab_ci.py @@ -11,10 +11,7 @@ from accept_merge_request import accept_merge_request from create_merge_request import create_merge_request from get_integration_sources import get_integration_sources from get_merge_requests import get_merge_requests -from update_submodule import ( - update_submodule_and_include_ref, - get_submodule_project_path_and_revision, -) +from update_submodule import update_submodule_and_include_ref from integrate_into_manifest import update_manifest, update_srcrev from ruamel.yaml import YAML @@ -143,6 +140,20 @@ def main(): required=False, default=False, ) + parser.add_argument( + "--project", + help="""gitlab-ci project path or id""", + dest="project", + default=os.environ.get("CI_PROJECT_PATH"), + required=False, + ) + parser.add_argument( + "--branch", + help="""gitlab-ci branch that we're merging into""", + dest="branch", + default="master", + required=False, + ) parser.add_argument( "--manifest-file", help="""manifest file name (default: 'default.xml')""", @@ -234,17 +245,10 @@ def main(): # ======================================================= if args.merge: # Get source merge request (the one in the gitlab-ci repo) - branch = manifest_integrations[0]["master_branch"] - if branch is None: - branch = manifest_integrations[0]["project"].default_branch - submodule_project_path, _ = get_submodule_project_path_and_revision( - manifest_integrations[0]["project"], args.submodule, branch - ) - submodule_project = common.get_project(gitlab, submodule_project_path) mrs = get_merge_requests( - submodule_project, - # TODO should this be submodule_project's default branch? - target_branch="master", + project=args.project, + target_branch=args.branch, + state="merged", commit=args.revision, ) if not mrs: -- GitLab