-
Notifications
You must be signed in to change notification settings - Fork 62
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
Messaging: Set the agent_name, usernames and groups properties #3099
Conversation
@@ -58,6 +65,10 @@ | |||
self.chroot, | |||
) | |||
|
|||
@property | |||
def agent_name(self): |
Check warning
Code scanning / vcs-diff-lint
BuildChrootStarted.agent_name: Missing function or method docstring Warning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The linter probably assigned this warning to a wrong position in code (more methods with the same name).
44394a5
to
7b2f173
Compare
"""The username who caused the action that generated this message.""" | ||
if self.status == "canceled": | ||
return self.submitter | ||
# The other statuses are not caused by the user who started the build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strictly speaking, anyone who has build or admin access to the project should be able to cancel the build. I don't think we have the needed info here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, would it be possible to add that info to the message body?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so, but this seems like a separate issue (the asynchronous cancelation on the remote machine is relatively complicated logic).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, does it make sense to mix up the submitter with the person who canceled the build? If yes, I think this PR is good to go. Otherwise, we should do something about it first, ideas?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed! Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be safe I didn't assume the submitter was the one who canceled the build. This may create notifications for people who didn't want to get notified of their own actions, but that's a lesser evil I think.
Thank you for working on this, @abompard! I'm not sure how precise we have to be here. E.g. what's the semantics of the |
Basically, in FMN there's a rule called "My Events", that will emit a notification when the user name in the message's |
This sets a couple properties that are standard in Fedora Messaging schemas and will allow notifications to be emitted by FMN. Signed-off-by: Aurélien Bompard <[email protected]>
7b2f173
to
5b43e44
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you.
FWIW a quick comment, as I foresee a problem here (but maybe my foresight is wrong, so take this with a gain of salt and simply ignore me if I'm talking rubbish!): In the old notifications systems the messages I got from gitlab webhook triggered builds were apparently referencing "gitlab.com:knurd42" as username (that's my gitlab account). Will there be a translation for this (doesn't look like it from the patch, but I might have easily missed something) or can I subscribe to that username in fmn (doesn't look like it either, but I might have easily missed something here as well). |
@knurd I don't think the But you are right I think. The problem is the agent_name, which is not doing any translation, and doing it probably isn't easy. Since |
Ah yes, I did not know that the submitter would be a namespaced username. |
Whohoo! This fassjson thingy is awesome, seems like usable for #2977!
If not namespaced, then it should already be a FAS account, sounds like a good idea to me.
The |
This is of course truth only for the Fedora Copr deployment, not other Copr deployments. |
It really shouldn't be so long, I need to check that. It's supposed to be an indexed LDAP call, so it should be very fast. But I'd appreciate if it were cached nonetheless ;-) Please note that I just realized that gitlab usernames can't be queried yet. It should be very easy to add though, only a couple lines. |
Thx to both of you for looking into/working on this, much appreciated. 👏 While at it a comment from the cheap seats that likely is unnecessary at this point: if looking up the github/gitlab names is to expensive/complicatd, I wonder if all of that could be avoided by sending the mails to the copr user that set up the "project package" in copr that acts when the webhook fires. |
Is this user available somewhere in the data dict that is used for the body of the message? If so, then yeah that'd be the best solution IMHO. |
Signed-off-by: Aurélien Bompard <[email protected]>
OK I've added a commit that should teach the schemas to ignore namespaced usernames in |
These are all good requests :-) like the other in this PR before; we need separate issue I bet, or even PR. |
The PR now LGTM, thank you @abompard |
That aspect was not fixed, wasn't it? If so: is it on some todo list, or do we need a ticket to ensure that does not fall through the cracks? |
Ohh, and btw, I still don't get notifications from copr for non-namespaces things I did. Is the new code maybe not yet deployed? |
If you want to track that, submit an issue, yes. And the release/deployment is probably going to happen on Thursday 8th of March. |
Thx, now done, see #3176 |
This sets a few properties that are standard in Fedora Messaging schemas and will allow notifications to be emitted by FMN.