Learn more about these different git repos.
Other Git URLs
This is a tracking ticket for myself.
@mikem has a patch here: https://github.com/mikem23/koji-playground/commits/post-commit-callback
In short, it will make our fedmsg publishing from koji "better".. but it's hard to test without a real environment.
I'm going to apply it by hand in staging to the kojihub. Kick off a build to test it. And then revert the change to bring things back to normal.
I'll note in this ticket when I start and when I'm done.
Also, you use a different msgbus plugin, so you'll need to apply similar changes to it.
Definitely.
Here's the patch I had to apply to ours:
diff --git a/roles/koji_hub/templates/fedmsg-koji-plugin.py b/roles/koji_hub/templates/fedmsg-koji-plugin.py index 0f95fca..d403aee 100644 --- a/roles/koji_hub/templates/fedmsg-koji-plugin.py +++ b/roles/koji_hub/templates/fedmsg-koji-plugin.py @@ -5,6 +5,7 @@ # Ralph Bean <rbean@redhat.com> # Mike Bonnet <mikeb@redhat.com> +from koji.context import context from koji.plugin import callbacks from koji.plugin import callback from koji.plugin import ignore_error @@ -118,10 +119,11 @@ def get_message_body(topic, *args, **kws): c for c in callbacks.keys() if c.startswith('post') and c not in [ 'postImport', # This is kind of useless; also noisy. + 'postCommit', # This is special. ] ]) @ignore_error -def send_message(cbtype, *args, **kws): +def prep_message(cbtype, *args, **kws): if cbtype.startswith('post'): msgtype = cbtype[4:] else: @@ -169,4 +171,16 @@ def send_message(cbtype, *args, **kws): body = scrub(body) - fedmsg.publish(topic=topic, msg=body, modname='buildsys') + message = dict(topic=topic, msg=body, modname='buildsys') + messages = getattr(context, 'fedmsg_plugin_messages', []) + messages.append(message) + context.fedmsg_plugin_messages = messages + + +# This only gets called at the end of the transaction. Flush our messages out to the bus. +@callback('postCommit') +@ignore_error +def send_messages(cbtype, *args, **kws): + messages = getattr(context, 'fedmsg_plugin_messages', []) + for message in messages: + fedmsg.publish(**message)
It appears to be working fine. I'll back out the changes now and hand things back to upstream koji.
OK, changes removed from staging koji. Everything back to normal.
I filed this ticket with upstream koji requesting that they move ahead with the change: https://pagure.io/koji/issue/147
This ticket can be closed now.
@kevin changed the status to Fixed
Fixed
Login to comment on this ticket.