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

Create separate integration branches for each target branch

This makes it possible to integrate a project branch into different
branches of the same manifest project.
parent f1170351
Branches
No related tags found
1 merge request!189Multiple integration pipelines
...@@ -102,7 +102,7 @@ build: ...@@ -102,7 +102,7 @@ build:
# FIXME: see FIXME comments in manifest-integration-pipelines.yml.jinja2 # FIXME: see FIXME comments in manifest-integration-pipelines.yml.jinja2
# project: $MANIFEST_PROJECT # project: $MANIFEST_PROJECT
project: {{ TARGET_PROJECT }} project: {{ TARGET_PROJECT }}
branch: "integrate/${CI_PROJECT_NAME}/${CI_COMMIT_REF_NAME}" branch: "integrate/${CI_PROJECT_NAME}/${CI_COMMIT_REF_NAME}/into/${MASTER_BRANCH_MANIFEST}"
strategy: depend strategy: depend
# -------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------
......
...@@ -28,7 +28,7 @@ def check_if_integration_branch_is_up_to_date( ...@@ -28,7 +28,7 @@ def check_if_integration_branch_is_up_to_date(
pass pass
if integration_branch is None: if integration_branch is None:
integration_branch_name = common.integration_branch_name( integration_branch_name = common.integration_branch_name(
project.name, merge_request.source_branch project.name, merge_request.source_branch, integration_base
) )
branch_list.append(integration_branch) branch_list.append(integration_branch)
try: try:
......
...@@ -17,9 +17,16 @@ srcrev_file = "SRCREV.conf" ...@@ -17,9 +17,16 @@ srcrev_file = "SRCREV.conf"
pending_states = ["created", "waiting_for_resource", "preparing", "pending", "running"] pending_states = ["created", "waiting_for_resource", "preparing", "pending", "running"]
def integration_branch_name(project_name, branch_name): def integration_branch_name(project_name, source_branch_name, target_branch_name):
"""Get integration branch name""" """Get integration branch name"""
return "integrate/" + project_name.lower() + "/" + branch_name return (
"integrate/"
+ project_name.lower()
+ "/"
+ source_branch_name
+ "/into/"
+ target_branch_name
)
def is_gitlab_ci_integration_branch(branch_name): def is_gitlab_ci_integration_branch(branch_name):
...@@ -231,7 +238,7 @@ def clone_project(project: Project, into, branch=None): ...@@ -231,7 +238,7 @@ def clone_project(project: Project, into, branch=None):
repo = Repo.clone_from(clone_url.url, into, branch=branch, depth=1) repo = Repo.clone_from(clone_url.url, into, branch=branch, depth=1)
except GitCommandError as e: except GitCommandError as e:
raise Exception("could not clone repository\n" + str(e)) from e raise Exception("could not clone repository\n" + str(e)) from e
except IndexError: except IndexError as e:
raise Exception("branch '%s' not found" % branch) from e raise Exception("branch '%s' not found" % branch) from e
return repo return repo
......
...@@ -119,7 +119,7 @@ def integrate_into_manifest( ...@@ -119,7 +119,7 @@ def integrate_into_manifest(
else: else:
# Create integration branch (delete former one if already exists) # Create integration branch (delete former one if already exists)
integration_branch = common.integration_branch_name( integration_branch = common.integration_branch_name(
project.name, merge_request.source_branch project.name, merge_request.source_branch, integration_base
) )
for ref in manifest_repo.references: for ref in manifest_repo.references:
if integration_branch == ref.name: if integration_branch == ref.name:
......
...@@ -52,9 +52,12 @@ def merge_into_manifest( ...@@ -52,9 +52,12 @@ def merge_into_manifest(
) )
return "" return ""
integration_branch = common.integration_branch_name(project.name, original_branch)
target_branch = master_branch target_branch = master_branch
integration_branch = common.integration_branch_name(
project.name, original_branch, target_branch
)
# Create merge request. If there already is a merge request, we assume that it has # Create merge request. If there already is a merge request, we assume that it has
# been opened manually and thus will be merged manually as well, so we fail here. # been opened manually and thus will be merged manually as well, so we fail here.
mr, created = create_merge_request( mr, created = create_merge_request(
......
...@@ -248,7 +248,7 @@ def update_submodule_and_include_ref( ...@@ -248,7 +248,7 @@ def update_submodule_and_include_ref(
# Construct integration branch name # Construct integration branch name
integration_branch_name = common.integration_branch_name( integration_branch_name = common.integration_branch_name(
submodule_project.name, integration_branch_suffix submodule_project.name, integration_branch_suffix, branch
) )
# Construct commit message # Construct commit message
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment