diff --git a/packit_service/worker/handlers/abstract.py b/packit_service/worker/handlers/abstract.py index f0547c973..d761d0048 100644 --- a/packit_service/worker/handlers/abstract.py +++ b/packit_service/worker/handlers/abstract.py @@ -122,7 +122,7 @@ class TaskName(str, enum.Enum): installation = "task.run_installation_handler" testing_farm = "task.run_testing_farm_handler" testing_farm_results = "task.run_testing_farm_results_handler" - propose_update_comment = "task.run_propose_update_comment_handler" + propose_downstream_comment = "task.run_propose_downstream_comment_handler" propose_downstream = "task.run_propose_downstream_handler" koji_build = "task.run_koji_build_handler" distgit_commit = "task.run_distgit_commit_handler" diff --git a/packit_service/worker/handlers/github_handlers.py b/packit_service/worker/handlers/github_handlers.py index b5e68f7c5..10637ced8 100644 --- a/packit_service/worker/handlers/github_handlers.py +++ b/packit_service/worker/handlers/github_handlers.py @@ -28,7 +28,6 @@ from typing import Optional from celery.app.task import Task - from ogr.abstract import CommitStatus, GitProject from packit.api import PackitAPI from packit.config import ( @@ -39,6 +38,7 @@ from packit.config.package_config import PackageConfig from packit.exceptions import PackitException from packit.local_project import LocalProject + from packit_service import sentry_integration from packit_service.constants import ( FAQ_URL_HOW_TO_RETRIGGER, @@ -144,7 +144,8 @@ def run(self) -> TaskResults: @configured_as(job_type=JobType.propose_downstream) -@run_for_comment(command="propose-update") +@run_for_comment(command="propose-downstream") +@run_for_comment(command="propose-update") # deprecated @reacts_to(event=ReleaseEvent) @reacts_to(event=IssueCommentEvent) class ProposeDownstreamHandler(JobHandler): @@ -204,22 +205,25 @@ def run(self) -> TaskResults: err_without_new_lines = err.replace("\n", " ") branch_errors += f"| `{branch}` | `{err_without_new_lines}` |\n" + msg_retrigger = MSG_RETRIGGER.format( + job="update", command="propose-downstream", place="issue" + ) body_msg = ( f"Packit failed on creating pull-requests in dist-git:\n\n" f"| dist-git branch | error |\n" f"| --------------- | ----- |\n" f"{branch_errors}\n\n" - f"{MSG_RETRIGGER.format(job='update', command='propose-update', place='issue')}\n" + f"{msg_retrigger}\n" ) self.project.create_issue( - title=f"[packit] Propose update failed for release {self.data.tag_name}", + title=f"[packit] Propose downstream failed for release {self.data.tag_name}", body=body_msg, ) return TaskResults( success=False, - details={"msg": "Propose update failed.", "errors": errors}, + details={"msg": "Propose downstream failed.", "errors": errors}, ) return TaskResults(success=True, details={}) diff --git a/tests/data/webhooks/github/issue_propose_update.json b/tests/data/webhooks/github/issue_propose_downstream.json similarity index 99% rename from tests/data/webhooks/github/issue_propose_update.json rename to tests/data/webhooks/github/issue_propose_downstream.json index cb6129822..6be7a8cfe 100644 --- a/tests/data/webhooks/github/issue_propose_update.json +++ b/tests/data/webhooks/github/issue_propose_downstream.json @@ -10,7 +10,7 @@ "id": 489618683, "node_id": "MDU6SXNzdWU0ODk2MTg2ODM=", "number": 512, - "title": "[DO-NOT-MERGE] testing /packit propose-update", + "title": "[DO-NOT-MERGE] testing /packit propose-downstream", "user": { "login": "phracek", "id": 3416672, @@ -73,7 +73,7 @@ "created_at": "2019-09-05T09:44:31Z", "updated_at": "2019-09-05T09:44:31Z", "author_association": "CONTRIBUTOR", - "body": "/packit propose-update" + "body": "/packit propose-downstream" }, "repository": { "id": 156365951, diff --git a/tests/integration/test_issue_comment.py b/tests/integration/test_issue_comment.py index a7fd05625..8758ada7b 100644 --- a/tests/integration/test_issue_comment.py +++ b/tests/integration/test_issue_comment.py @@ -46,9 +46,9 @@ @pytest.fixture(scope="module") -def issue_comment_propose_update_event(): +def issue_comment_propose_downstream_event(): return json.loads( - (DATA_DIR / "webhooks" / "github" / "issue_propose_update.json").read_text() + (DATA_DIR / "webhooks" / "github" / "issue_propose_downstream.json").read_text() ) @@ -91,8 +91,8 @@ def mock_issue_comment_functionality(): flexmock(Whitelist, check_and_report=True) -def test_issue_comment_propose_update_handler( - mock_issue_comment_functionality, issue_comment_propose_update_event +def test_issue_comment_propose_downstream_handler( + mock_issue_comment_functionality, issue_comment_propose_downstream_event ): flexmock(PackitAPI).should_receive("sync_release").and_return( PullRequest( @@ -120,7 +120,9 @@ def test_issue_comment_propose_update_handler( ) flexmock(Signature).should_receive("apply_async").once() - processing_results = SteveJobs().process_message(issue_comment_propose_update_event) + processing_results = SteveJobs().process_message( + issue_comment_propose_downstream_event + ) event_dict, job, job_config, package_config = get_parameters_from_results( processing_results ) diff --git a/tests/integration/test_release_event.py b/tests/integration/test_release_event.py index bb6f31b73..521472b84 100644 --- a/tests/integration/test_release_event.py +++ b/tests/integration/test_release_event.py @@ -206,12 +206,12 @@ def test_dist_git_push_release_handle_all_failed( ) .should_receive("create_issue") .with_args( - title="[packit] Propose update failed for release 0.3.0", + title="[packit] Propose downstream failed for release 0.3.0", body="Packit failed on creating pull-requests in dist-git:\n\n" "| dist-git branch | error |\n" "| --------------- | ----- |\n" f"{table_content}\n\n" - "You can retrigger the update by adding a comment (`/packit propose-update`)" + "You can retrigger the update by adding a comment (`/packit propose-downstream`)" " into this issue.\n", ) .once() diff --git a/tests/unit/test_events.py b/tests/unit/test_events.py index b9368f0f9..c84c57fc3 100644 --- a/tests/unit/test_events.py +++ b/tests/unit/test_events.py @@ -99,9 +99,9 @@ def github_installation(self, request): return json.load(outfile) @pytest.fixture() - def github_issue_comment_propose_update(self): + def github_issue_comment_propose_downstream(self): with open( - DATA_DIR / "webhooks" / "github" / "issue_propose_update.json" + DATA_DIR / "webhooks" / "github" / "issue_propose_downstream.json" ) as outfile: return json.load(outfile) @@ -446,8 +446,8 @@ def test_parse_pr_comment_empty(self, github_pr_comment_empty): assert event_object.package_config - def test_parse_issue_comment(self, github_issue_comment_propose_update): - event_object = Parser.parse_event(github_issue_comment_propose_update) + def test_parse_issue_comment(self, github_issue_comment_propose_downstream): + event_object = Parser.parse_event(github_issue_comment_propose_downstream) assert isinstance(event_object, IssueCommentEvent) assert event_object.action == IssueCommentAction.created @@ -461,7 +461,7 @@ def test_parse_issue_comment(self, github_issue_comment_propose_update): assert event_object.base_ref == "master" assert event_object.project_url == "https://github.com/packit-service/packit" assert event_object.user_login == "phracek" - assert event_object.comment == "/packit propose-update" + assert event_object.comment == "/packit propose-downstream" assert isinstance(event_object.project, GithubProject) assert event_object.project.full_repo_name == "packit-service/packit"