-
Notifications
You must be signed in to change notification settings - Fork 4
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
Feat: add discord webhook helpers #1045
Conversation
Just a quick correction, is seems that you have implemented code for both failed builds with tests but also for trees with no builds, tests or boots, or am I overlooking something? |
92ee98d
to
beb769a
Compare
@@ -26,6 +29,13 @@ def get(self, request, build_id: str) -> Response: | |||
status=HTTPStatus.OK, | |||
) | |||
|
|||
if result[0]["build__valid"] is False: |
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.
check if result[0] exists
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 that the if before (if not result
) should be enough, shouldn't it?
Python 3.12.7 (main, Nov 18 2024, 15:03:02) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> a = []
>>> not a
True
>>> a.append(1)
>>> not a
False
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.
but I'd still do
if result[0]["build__valid"] is False: | |
if result[0].get("build__valid") is False: |
just to be sure
b982a81
to
15ce9bf
Compare
@@ -45,6 +45,7 @@ services: | |||
- DB_DEFAULT_USER=${DB_DEFAULT_USER:-kernelci} | |||
- DJANGO_SECRET_KEY=${DJANGO_SECRET_KEY} | |||
- DEBUG=False | |||
- DISCORD_WEBHOOK_URL=${DISCORD_WEBHOOK_URL} |
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.
Add the env description to the backend README file
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.
nice job, worked on my tests
15ce9bf
to
3c565cd
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.
Worked well on my tests
Adds helper functions to send messages using a discord webhook
How to test
Get a discord webhook url, by going to discord server settings, creating or viewing a webhook and copying its URL
Set the environment variable
DISCORD_WEBHOOK_URL
with the url of your webhook (should look something likehttps://discord.com/api/webhooks/<id>/<webhook_id>
)Currently there is only a notification for failed builds that had tests, such as this localhost buildDetails
Closes #1027