Update the commops-watch IRC bot to only send fedmsg events in #fedora-commops for new Pagure issues and new Pagure pull requests
#fedora-commops
In the #fedora-commops IRC channel on Freenode, the [commops-watch](https://infrastructure.fedoraproject.org/cgit/ansible.git/tree/roles/fedmsg/irc/templates/ircbot.py?id=0279643#n96) bot listens to fedmsg for anything that mentions the CommOps team. This includes this repository.
[commops-watch](https://infrastructure.fedoraproject.org/cgit/ansible.git/tree/roles/fedmsg/irc/templates/ircbot.py?id=0279643#n96)
Right now, if you join the channel, commops-watch is spammy. It posts a lot of updates for everything in this repo, from adding a label or for someone editing a comment. Not all of these notifications from Pagure are useful. The most useful notifications from Pagure for our team are for new issues and new pull requests* only.
commops-watch
Therefore, the IRC bot should be configured to only send fedmsg events for these two things from Pagure.
In the Fedora Infrastructure Ansible repository, there is a Python script called ircbot.py that creates the IRC bots. commops-watch is defined here. It uses the fedmsg API to listen for activity on the fedmsg feed.
ircbot.py
I think the best solution is to modify the topic syntax to only listen for Pagure notifications with the topics pagure.pull-request.new and pagure.issue.new.
pagure.pull-request.new
pagure.issue.new
Note: To make this contribution, you will need to submit a git patch to the Fedora Infrastructure mailing list. To set up your environment quickly, use the following commands:
git clone https://infrastructure.fedoraproject.org/infra/ansible.git fedora-infra-ansible cd fedora-infra-ansible git checkout -b my-changes/commops-bot
Inside the repo, the file is located here: roles/fedmsg/irc/templates/ircbot.py
roles/fedmsg/irc/templates/ircbot.py
commops-watch is more practically useful and doesn't drown out real conversations with bot noise
@jflory7 Can I take this up?
@richa208 Sure. A next step would be to suggest what changes are needed to make this work as explained above. It's tricky to independently test this change, so we need to figure out the right fix before sending the patch to Fedora Infrastructure team.
@richa208 do you want to work on this issue? if yes, I can assign it to you
@jonatoni Yes I want to work on it
@richa208 Try to make a start on this with the provided resources and see what you come up with. You don't need permission to start working on this one. :smiley: Let us know what your ideas are with a new comment in this ticket.
@jflory7 According to the resources provided by you, in my opinion we can do one of the following:
To set up your environment quickly, use the following commands:
I have set up my environment as per your instructions. Kindly tell what needs to be done now.
Modify the topic to listen for pagure.pull-request.new and pagure.issue.new only.
@richa208 I prefer this option so we can keep all the notifications to one bot.
Kindly tell what needs to be done now.
Excellent. Did you go ahead and commit your change? If so, your next step is to create a patch file and upload it to this ticket for review. To submit this contribution, we will email the patch to the Fedora Infrastructure mailing list.
The easiest way to make a patch file of a specific commit is with this command:
git format-patch -1 <commit hash>
For more help, I recommend reading the git-format-patch manual page.
git-format-patch
Once you have the patch file, please upload it to this ticket and we will review it. If it is ready to go, I'll offer some steps on how we can get this merged. :thumbsup:
@jflory7 As per your intructions, I have created the patch file.
If there are any changes to be done please suggest.
As per your intructions, I have created the patch file.
@richa208 This change looks great. :thumbsup:
One small thing. For your commit message, could you add more detail to the commit message? See this article for a quick explanation about writing commit messages. Please reword the commit message and upload a new patch file when you have time.
Thanks for working on this!
@jflory7 Is this okay?
Perfect! Thanks.
The next step is to send the patch to the Fedora Infrastructure mailing list for review. Normally I could merge it, but the Fedora 30 Beta Freeze began yesterday. Instead, you can send a change freeze.
The Fedora Infrastructure mailing list is found here. You can add your patch file as an attachment to an email on the mailing list. Your email can be a couple of sentences to explain the change, and you can link back to this ticket URL. The docs linked above should help explain the process too.
When you have a chance, could you send the patch as a change freeze?
@jflory7 I have sent the patch to the mailing list :smiley:
@jflory7 I have sent the patch to the mailing list 😃
Great, thanks @richa208! For reference, the mailing list thread is here.
I am marking this ticket priority to waiting on external, since we need Fedora Infrastructure folks to review the patch and sign off on it. This should happen in 48 hours or so. If there's no feedback after then, I'll try to poke at getting a review.
Metadata Update from @jflory7: - Issue untagged with: help wanted - Issue assigned to richa208 - Issue priority set to: waiting on external (was: waiting on assignee)
Metadata Update from @jflory7: - Issue set to the milestone: Summer Coding 2019: community bonding
@richa208 Awesome work! Fedora Infra applied your patch and the bot was restarted. I confirmed the notifications now work as expected in #fedora-commops. This should make the channel easier for folks to talk in, not just get spammed by messages.
Thanks for doing this, I really appreciate this change! :tada: Closing this ticket as complete. :clapper:
Metadata Update from @jflory7: - Issue close_status updated to: complete - Issue status updated to: Closed (was: Open)