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

Refactoring: rename arguments for consistency

parent d461090b
No related branches found
No related tags found
1 merge request!189Multiple integration pipelines
......@@ -42,7 +42,7 @@ integrate:
--token=${GITBOT_TOKEN}
--manifest-project=${TARGET_PROJECT}
--manifest-file=${MANIFEST_FILE}
--integration-base=${TARGET_BRANCH}
--manifest-branch=${TARGET_BRANCH}
--project=${CI_PROJECT_PATH}
--merge-request=${MERGE_REQUEST}
--save-revision-to=manifest_revision
......@@ -68,9 +68,9 @@ merge:
--gitlab-url=${CI_SERVER_URL}
--token=${GITBOT_TOKEN}
--manifest-project=${TARGET_PROJECT}
--master-branch=${TARGET_BRANCH}
--manifest-branch=${TARGET_BRANCH}
--project=${CI_PROJECT_PATH}
--master-branch-project=${SOURCE_BRANCH}
--project-branch=${SOURCE_BRANCH}
--commit=${CI_COMMIT_SHA}
--save-revision-to=manifest_revision
--recipe-name=${BB_RECIPE_NAME}
......
......@@ -72,7 +72,7 @@ def update_srcrev(srcrev, recipe_name, new_revision):
def integrate_into_manifest(
manifest_project: Project,
integration_base,
manifest_branch,
manifest_file,
srcrev_file,
recipe_name,
......@@ -95,12 +95,12 @@ def integrate_into_manifest(
print("Cloning manifest repo: %s" % manifest_project.http_url_to_repo)
try:
manifest_repo = Repo.clone_from(
clone_url.url, manifest_dir, branch=integration_base
clone_url.url, manifest_dir, branch=manifest_branch
)
except GitCommandError as e:
sys.exit("ERROR: could not clone manifest repository\n" + str(e))
except IndexError:
sys.exit("ERROR: branch '%s' not found" % integration_base)
sys.exit("ERROR: branch '%s' not found" % manifest_branch)
# Special handling for the gitlab-ci integration
# When the branch 'merge_request.source_branch' already starts with
......@@ -121,7 +121,7 @@ def integrate_into_manifest(
else:
# Create integration branch (delete former one if already exists)
integration_branch = common.integration_branch_name(
project.name, merge_request.source_branch, integration_base
project.name, merge_request.source_branch, manifest_branch
)
for ref in manifest_repo.references:
if integration_branch == ref.name:
......@@ -210,9 +210,9 @@ def main():
required=True,
)
parser.add_argument(
"--integration-base",
"--manifest-branch",
help="""manifest branch to branch off from""",
dest="integration_base",
dest="manifest_branch",
required=True,
)
parser.add_argument(
......@@ -280,7 +280,7 @@ def main():
manifest_revision = integrate_into_manifest(
manifest_project=manifest_project,
integration_base=args.integration_base,
manifest_branch=args.manifest_branch,
manifest_file=args.manifest_file,
srcrev_file=args.srcrev_file,
recipe_name=args.recipe_name,
......
......@@ -14,9 +14,9 @@ from integrate_into_manifest import integrate_into_manifest
def merge_into_manifest(
manifest_project,
master_branch,
manifest_branch,
project,
master_branch_project,
project_branch,
srcrev_file,
recipe_name,
commit,
......@@ -30,7 +30,7 @@ def merge_into_manifest(
# Get source merge request
mrs = get_merge_requests(
project,
target_branch=master_branch_project,
target_branch=project_branch,
state="merged",
commit=commit,
)
......@@ -52,7 +52,7 @@ def merge_into_manifest(
)
return ""
target_branch = master_branch
target_branch = manifest_branch
integration_branch = common.integration_branch_name(
project.name, original_branch, target_branch
......@@ -95,7 +95,7 @@ def merge_into_manifest(
# we want a completely automated process in every case.
manifest_revision = integrate_into_manifest(
manifest_project=manifest_project,
integration_base=target_branch,
manifest_branch=target_branch,
manifest_file=common.manifest_file,
srcrev_file=srcrev_file,
recipe_name=recipe_name,
......@@ -139,9 +139,9 @@ def main():
required=True,
)
parser.add_argument(
"--master-branch",
help="""master branch to merge changes into""",
dest="master_branch",
"--manifest-branch",
help="""manifest branch to merge changes into""",
dest="manifest_branch",
required=True,
)
parser.add_argument(
......@@ -151,9 +151,9 @@ def main():
required=True,
)
parser.add_argument(
"--master-branch-project",
help="""master branch to merge changes into (project)""",
dest="master_branch_project",
"--project-branch",
help="""project branch to merge changes into""",
dest="project_branch",
default=None,
required=False,
)
......@@ -198,16 +198,15 @@ def main():
project = common.get_project(gitlab, args.project)
manifest_project = common.get_project(gitlab, args.manifest_project)
# If no master_branch_project is set assume manifest and project
# master branches are named the same
if not args.master_branch_project:
args.master_branch_project = args.master_branch
# If no project_branch is set, assume manifest and project branches are the same
if not args.project_branch:
args.project_branch = args.manifest_branch
manifest_revision = merge_into_manifest(
manifest_project=manifest_project,
master_branch=args.master_branch,
manifest_branch=args.manifest_branch,
project=project,
master_branch_project=args.master_branch_project,
project_branch=args.project_branch,
srcrev_file=args.srcrev_file,
recipe_name=args.recipe_name,
commit=args.commit,
......
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