Skip to content
Snippets Groups Projects
Commit ee63ceae authored by Emanuele Aina's avatar Emanuele Aina
Browse files

pkg-merge-upstream-to-downstreams: Don't automerge on conflicts


Do not enable `merge_when_pipeline_succeeds` when the update pipeline
failed to merge and a MR with the unmerged branch is created.

Otherwise the MR will unexpectedly be merged immediately as soon as the
pipeline succeeds when someone pushes the manually resolved merge.

Signed-off-by: Emanuele Aina's avatarEmanuele Aina <emanuele.aina@collabora.com>
parent 38b9a793
No related branches found
No related tags found
2 merge requests!237pkg-merge-upstream-to-downstreams: Don't automerge on conflicts,!93WIP: documentation-builder: Rebase on Apertis instead of Debian Buster
Pipeline #279687 passed
......@@ -162,7 +162,7 @@ def main():
ref = git("rev-parse", downstream_branch).rstrip()
proposed_branch = f"proposed-updates/{upstream_branch}/{ref[0:8]}"
push_this_merge_request = partial(push_merge_request, args.project_url, proposed_branch, upstream_branch, downstream_branch, auto_merge, dry_run=args.dry_run)
push_this_merge_request = partial(push_merge_request, args.project_url, proposed_branch, upstream_branch, downstream_branch, dry_run=args.dry_run)
# check if we have a proposed branch from a previous iteration
if git("rev-parse", "--verify", proposed_branch, _ok_code=[0, 128]).strip():
......@@ -177,7 +177,7 @@ def main():
# submit a MR from proposed-updates/debian/buster/badf00d
# to apertis/v2020
print(f"Reusing branch {proposed_branch} to be merged into {downstream_branch}")
push_this_merge_request()
push_this_merge_request(auto_merge=auto_merge)
continue
git("branch", proposed_branch, upstream_branch)
......@@ -185,6 +185,7 @@ def main():
print(f"Attempt merging {upstream_branch} into {downstream_branch} via {proposed_branch}", flush=True)
git("checkout", "--force", "-B", "tmp", downstream_branch)
conflict = None
auto_merge_override = auto_merge
try:
apertis_pkg_merge_updates(f"--osname={osname}", f"--downstream={downstream_branch}",
f"--upstream={upstream_branch}", f"--local-version-suffix={local_suffix}",
......@@ -192,6 +193,7 @@ def main():
git("branch", "--force", proposed_branch, "HEAD")
except ErrorReturnCode:
print(f"Failed to merge {upstream_branch} into {downstream_branch} via {proposed_branch}")
auto_merge_override = []
conflict = Conflict(
upstream_branch=upstream_branch,
downstream_branch=downstream_branch,
......@@ -207,7 +209,7 @@ def main():
continue
print(f"Submit {proposed_branch} for merging into {downstream_branch} the updates from {upstream_branch}")
push_this_merge_request()
push_this_merge_request(auto_merge=auto_merge_override)
if conflicts:
print("\n⚠️ Failed to automatically merge the updates below.")
......
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