Add Discord - Send Notification step template#1697
Open
Meanski wants to merge 1 commit into
Open
Conversation
|
Review this PR in Hyponome for a side-by-side diff of the step-template JSON and any embedded scripts. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
Adds a new step template, Discord - Send Notification, which posts a message and/or rich embed to a Discord channel via a webhook. There are currently no Discord templates in the library.
Webhooks were chosen deliberately over a Discord application/bot: a notification-only step needs no OAuth, bot token, or server install — users create a webhook in the channel settings and paste its URL into the step. This mirrors the approach of the existing Slack notification templates.
What the step does:
autocolour option picks green or red based on whether the deployment has an error (Octopus.Deployment.Error), so a single step with a "run always" condition reports the deployment outcome correctly either way.@everyone/role/user mentions by default (viaallowed_mentions) so interpolated release notes can't accidentally ping a server; this can be disabled deliberately.?wait=trueand sets the created message's ID as theMessageIdoutput variable for downstream steps.retry_after, and truncates content/title/description to Discord's limits.Implementation notes:
curland eitherjqorpython3on the worker (falls back from jq to python3 for JSON encoding/parsing).Results
A new Discord - Send Notification step template under a new discord category.
Before
n/a — new step template; no Discord templates exist in the library today.
After
Verified end-to-end from an Octopus Cloud instance against a real Discord server, for both deployment outcomes.
Success path (green embed):
Failure path — a deliberately failing first step, with the notification step's condition set to "Always" (red embed, deployment correctly reported as Failed):
Also verified: mention suppression, username/avatar overrides, embed detail fields, the deployment link on the embed title, and error handling (invalid webhook token → Discord 401 surfaced with code and message, step fails with a non-zero exit code). Rate-limit retry (429 honouring
retry_after) was exercised with a mocked API.gulp testspasses locally (4 specs, 0 failures).Pre-requisites
Idshould be a GUID that is not00000000-0000-0000-0000-000000000000Idproperty (updating theIdwill break the Library sync functionality in Octopus).Versionshould be incremented, otherwise the integration with Octopus won't update the step template correctly$LastModifiedByfield must be present, and (optionally) updated with the correct authorCategoryhas been created:{categoryname}.pngmust be present under thestep-templates/logosfolderswitchin thehumanizefunction ingulpfile.babel.jsmust have acasestatement corresponding to it