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

make copr_messaging optional #2590

Merged
merged 1 commit into from
Mar 27, 2023
Merged

Conversation

pkking
Copy link
Contributor

@pkking pkking commented Mar 23, 2023

#2589 My thoughts stay straightforward, just make the copr_messaging and fedmsg into weak dependency...

@github-advanced-security
Copy link

You have successfully added a new vcs-diff-lint configuration .github/workflows/python-diff-lint.yml:python-lint-job. As part of the setup process, we have scanned this repository and found 1 existing alert. Please check the repository Security tab to see all alerts.

@praiskup
Copy link
Member

@jmacku, any idea if we could avoid the initial You have successfully added a new vcs-diff-lint configuration ... message? That message spams every single PR.

@@ -33,6 +39,8 @@ def message_from_worker_job(style, topic, job, who, ip, pid):
once we can exepect that people are using copr-messaging module (and thus
we can change message format without affecting the API).
"""
if not copr_messaging_enabled:
return None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this is not needed, what is the traceback you face if you uninstall python-copr-messaging?

MessageSender.announce() calls bus.announce_job() only if some bus is configured (which shouldn't be your case) therefore neither message_from_worker_job shouldn't be called.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, in today's codebase, there's no need to add these lines.
But i want to make this method more robust, maybe it was call by another function in future, and the caller may not know our assumptions.
The schema in the context is undefined and may cause an exception.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just feels weird, maybe the position in code, I'm not sure.

If things work for you just like that, can we just (and resolve the rest later?):

ry:
    from copr_messaging import schema
except ImportError:
    # copr_messaging is optional
    schema = None

@jmacku
Copy link

jmacku commented Mar 24, 2023

@jamacku I guess this ^ was meant for you ;-)

@jamacku
Copy link

jamacku commented Mar 25, 2023

@praiskup It's GitHub's "new" feature, but it is messy. It requires you to upload SARIF on the push event as well.

I was dealing with this issue in:

Signed-off-by: lichaoran <pkwarcraft@gmail.com>
@praiskup praiskup merged commit 23830d2 into fedora-copr:main Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants