-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
[#1056] Added support for a webhook notification. #1273
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1273 +/- ##
===========================================
- Coverage 69.58% 60.09% -9.50%
===========================================
Files 40 41 +1
Lines 2999 3047 +48
===========================================
- Hits 2087 1831 -256
- Misses 912 1216 +304 ☔ View full report in Codecov by Sentry. |
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.
@tannguyen04
Thank you for working on this.
We need to significantly simplify this to avoid using tokens and jq
. The headers and body should also be simplified.
The value of DREVOPS_NOTIFY_WEBHOOK_PAYLOAD
(used for body) should come from the outside of the script.
By default, we should be providing a JSON string with values similar to what is used in notify-email.sh
- please see how that message is created.
The fields are: message
(friendly message as in notify-email.sh
), environment_url
, project
, ref
, timestamp
.
The core of this script should be a simple curl call:
if ! curl -L -s -o /dev/null -w '%{http_code}' \
-X "${DREVOPS_NOTIFY_WEBHOOK_METHOD}" \
-H "${DREVOPS_NOTIFY_WEBHOOK_HEADERS}" \
-d "${DREVOPS_NOTIFY_WEBHOOK_PAYLOAD}" \
"${DREVOPS_NOTIFY_WEBHOOK_URL}" | grep -q "${DREVOPS_NOTIFY_WEBHOOK_RESPONSE_STATUS}"; then
fail "Unable to send notification to webhook ${DREVOPS_NOTIFY_WEBHOOK_URL}."
exit 1
fi
19e43b8
to
02d02a1
Compare
Checklist before requesting a review
closes #1056
[#123] Verb in past tense with dot at the end.
Changed
section about WHY something was done if this was not a normal implementationChanged
Screenshots