Skip to content

Commit

Permalink
Do not check owner for Koji non-scratch builds (#104)
Browse files Browse the repository at this point in the history
Do not check owner for Koji non-scratch builds

Needed for packit/packit-service#2312
RELEASE NOTES BEGIN
N/A
RELEASE NOTES END

Reviewed-by: František Lachman <[email protected]>
Reviewed-by: Maja Massarini
  • Loading branch information
2 parents 695d3f7 + ddda9ee commit e58d9f2
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions packit_service_fedmsg/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,26 +47,21 @@ def _copr(topic: str, event: dict, packit_user: str) -> CallbackResult:


def _koji(topic: str, event: dict, packit_user: str) -> CallbackResult:
# TODO: accept builds run by other owners as well
# (For the `bodhi_update` job.)
if event.get("owner") != packit_user:
return CallbackResult(
msg=f"[Koji] Koji build not built by {packit_user}.",
pass_to_service=False,
)

if "buildsys.build.state" in topic:
what = (
f"[Koji] build:{event.get('build_id')} task:{event.get('task_id')}"
f" {event.get('old')}->{event.get('new')}"
)
return CallbackResult(msg=what)

# SAFETY: It's either ‹build.state› or ‹task.state›, as they are the topics
# handled by this callback, therefore ‹what› **will** be declared one way or
# another.
if "buildsys.task.state" in topic: # scratch build
what = f"[Koji] id:{event.get('id')} {event.get('old')}->{event.get('new')}"
# for scratch builds, consider only builds by packit
if event.get("owner") != packit_user:
return CallbackResult(
msg=f"[Koji] Koji scratch build not built by {packit_user}.",
pass_to_service=False,
)

what = f"[Koji] id:{event.get('id')} {event.get('old')}->{event.get('new')}"
return CallbackResult(msg=what)


Expand Down

0 comments on commit e58d9f2

Please sign in to comment.