Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to org.fedoraproject.prod.pagure.git.receive #2303

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packit_service/worker/events/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ class IssueCommentAction(Enum):


class FedmsgTopic(Enum):
dist_git_push = "org.fedoraproject.prod.git.receive"
dist_git_push = "org.fedoraproject.prod.pagure.git.receive"
copr_build_finished = "org.fedoraproject.prod.copr.build.end"
copr_build_started = "org.fedoraproject.prod.copr.build.start"
4 changes: 2 additions & 2 deletions packit_service/worker/handlers/distgit.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ class AbortSyncRelease(Exception):
@reacts_to(event=AbstractIssueCommentEvent)
@reacts_to(event=CheckRerunReleaseEvent)
class ProposeDownstreamHandler(AbstractSyncReleaseHandler):
topic = "org.fedoraproject.prod.git.receive"
topic = "org.fedoraproject.prod.pagure.git.receive"
task_name = TaskName.propose_downstream
helper_kls = ProposeDownstreamJobHelper
sync_release_job_type = SyncReleaseJobType.propose_downstream
Expand Down Expand Up @@ -646,7 +646,7 @@ class AbstractDownstreamKojiBuildHandler(
This handler can submit a build in Koji from a dist-git.
"""

topic = "org.fedoraproject.prod.git.receive"
topic = "org.fedoraproject.prod.pagure.git.receive"
task_name = TaskName.downstream_koji_build

def __init__(
Expand Down
14 changes: 7 additions & 7 deletions packit_service/worker/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1078,25 +1078,25 @@ def parse_release_event(event) -> Optional[ReleaseEvent]:
def parse_pagure_push_event(event) -> Optional[PushPagureEvent]:
"""this corresponds to dist-git event when someone pushes new commits"""
topic = event.get("topic")
if topic != "org.fedoraproject.prod.git.receive":
if topic != "org.fedoraproject.prod.pagure.git.receive":
return None

logger.info(f"Dist-git commit event, topic: {topic}")

dg_repo_namespace = nested_get(event, "commit", "namespace")
dg_repo_name = nested_get(event, "commit", "repo")
dg_repo_namespace = nested_get(event, "repo", "namespace")
dg_repo_name = nested_get(event, "repo", "name")

if not (dg_repo_namespace and dg_repo_name):
logger.warning("No full name of the repository.")
return None

dg_branch = nested_get(event, "commit", "branch")
dg_commit = nested_get(event, "commit", "rev")
dg_branch = nested_get(event, "branch")
dg_commit = nested_get(event, "end_commit")
if not (dg_branch and dg_commit):
logger.warning("Target branch/rev for the new commits is not set.")
return None

username = nested_get(event, "commit", "username")
username = nested_get(event, "agent")

logger.info(
f"New commits added to dist-git repo {dg_repo_namespace}/{dg_repo_name},"
Expand Down Expand Up @@ -1591,7 +1591,7 @@ def parse_new_hotness_update_event(event) -> Optional[NewHotnessUpdateEvent]:
"pagure.pull-request.flag.added": parse_pagure_pr_flag_event.__func__, # type: ignore
"pagure.pull-request.flag.updated": parse_pagure_pr_flag_event.__func__, # type: ignore
"pagure.pull-request.comment.added": parse_pagure_pull_request_comment_event.__func__, # type: ignore # noqa: E501
"git.receive": parse_pagure_push_event.__func__, # type: ignore
"pagure.git.receive": parse_pagure_push_event.__func__, # type: ignore
"copr.build.start": parse_copr_event.__func__, # type: ignore
"copr.build.end": parse_copr_event.__func__, # type: ignore
"buildsys.task.state.change": parse_koji_task_event.__func__, # type: ignore
Expand Down
47 changes: 8 additions & 39 deletions tests/data/fedmsg/distgit_commit.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,11 @@
{
"topic": "org.fedoraproject.prod.git.receive",
"commit": {
"agent": "rhcontainerbot",
"branch": "main",
"email": "[email protected]",
"message": "buildah-1.12.0-0.73.dev.git1e6a70c\n\n- autobuilt 1e6a70c\n\nSigned-off-by: RH Container Bot <[email protected]>\n",
"name": "Packit",
"agent": "rhcontainerbot",
"branch": "main",
"end_commit": "abcd",
"total_commits": 1,
"repo": {
"namespace": "rpms",
"path": "/srv/git/repositories/rpms/buildah.git",
"repo": "buildah",
"rev": "abcd",
"seen": false,
"stats": {
"files": {
".gitignore": {
"additions": 1,
"deletions": 0,
"lines": 1
},
"buildah.spec": {
"additions": 5,
"deletions": 2,
"lines": 7
},
"sources": {
"additions": 1,
"deletions": 1,
"lines": 2
}
},
"total": {
"additions": 7,
"deletions": 3,
"files": 3,
"lines": 10
}
},
"summary": "buildah-1.12.0-0.73.dev.git1e6a70c",
"username": "rhcontainerbot"
}
"name": "buildah"
},
"topic": "org.fedoraproject.prod.pagure.git.receive"
}
55 changes: 7 additions & 48 deletions tests/data/fedmsg/distgit_push_packit.json
Original file line number Diff line number Diff line change
@@ -1,52 +1,11 @@
{
"commit": {
"agent": "pagure",
"branch": "f36",
"email": "[email protected]",
"message": "[packit] 0.50.0 upstream release\n\nUpstream tag: 0.50.0\nUpstream commit: c3667a91\n\nSigned-off-by: Packit <[email protected]>\n",
"name": "Packit",
"agent": "pagure",
"branch": "f36",
"end_commit": "ad0c308af91da45cf40b253cd82f07f63ea9cbbf",
"total_commits": 1,
"repo": {
"namespace": "rpms",
"path": "/srv/git/repositories/rpms/packit.git",
"repo": "packit",
"rev": "ad0c308af91da45cf40b253cd82f07f63ea9cbbf",
"seen": false,
"stats": {
"files": {
".gitignore": {
"additions": 1,
"deletions": 0,
"lines": 1
},
"README.packit": {
"additions": 1,
"deletions": 1,
"lines": 2
},
"packit.spec": {
"additions": 9,
"deletions": 1,
"lines": 10
},
"plans/main.fmf": {
"additions": 1,
"deletions": 1,
"lines": 2
},
"sources": {
"additions": 1,
"deletions": 1,
"lines": 2
}
},
"total": {
"additions": 13,
"deletions": 4,
"files": 5,
"lines": 17
}
},
"summary": "[packit] 0.50.0 upstream release",
"username": "pagure"
"name": "packit"
},
"topic": "org.fedoraproject.prod.git.receive"
"topic": "org.fedoraproject.prod.pagure.git.receive"
}