Skip to content

Commit

Permalink
Slight adjustments
Browse files Browse the repository at this point in the history
Allow closing MRs
Directly open MRs after closing them
  • Loading branch information
janboll committed Mar 22, 2024
1 parent 26e8ddb commit 9ad367e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions reconcile/templating/lib/merge_request_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,15 +239,15 @@ def create_tr_merge_request(self, output: list[TemplateOutput]) -> None:
logging.info(
"MR already exists and has the same template hash. Skipping",
)
return None
else:
logging.info(
"Template hash changed. Closing it",
"Collection Hash changed. Closing it",
)
self._vcs.close_app_interface_mr(
mr.raw,
"Closing this MR because the template hash has changed.",
"Closing this MR because the collection hash has changed.",
)
return None

description = render_description(collection, collection_hash)
title = render_title(collection)
Expand Down
2 changes: 1 addition & 1 deletion reconcile/templating/renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def run(self, dry_run: bool) -> None:
gitlab_instances=get_gitlab_instances(),
app_interface_repo_url=get_app_interface_repo_url(),
dry_run=dry_run,
allow_deleting_mrs=False,
allow_deleting_mrs=True,
allow_opening_mrs=True,
)
merge_request_manager = MergeRequestManager(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,10 @@ def test_create_tr_merge_request_found(
)
if closed:
vcs.close_app_interface_mr.assert_called_once()
vcs.open_app_interface_merge_request.assert_called_once()
else:
vcs.close_app_interface_mr.assert_not_called()
vcs.open_app_interface_merge_request.assert_not_called()
vcs.open_app_interface_merge_request.assert_not_called()


@pytest.mark.parametrize(
Expand Down

0 comments on commit 9ad367e

Please sign in to comment.