Read me!
This repo has been moved to jenkinsci organization. Please submit issues/PRs there.
Discord Notifier
Discord Notifier provides a bridge between Jenkins and Discord through the built-in webhook functionality.
The purpose
The Jenkins Discord Webhook plugin was made to share results of a build to a Discord channel using the webhooks that Discord provides.
Through this plugin you are able to:
- [x] Get success and fail messages about your build
- [x] Link to build artifacts
- [x] List SCM changes to the build
- [x] Only send notifications on state change
Download
You'll have to manually install the plugin via the advanced tab of your plugin settings.
A Jenkins plugin repo build will be available soon.
Usage
This plugin uses the post-build feature to execute a request.
After installing, go to your job's configure section and add the Discord Notifier item. Then proceed to enter your webhook URL.
There are a few options you can choose from:
- Webhook URL
- The URL of the webhook (pretty self-explanatory) provided by Discord
- Send only on state change
- Checking this will only send the message when the state of the current build differs from the previous
- Advanced:
- thumbnail
- If set, the image under the URL shows up on the right side of Discord message.
- Enable URL linking
- Enables the title, build summary and build id to be linked to the build. Requires the URL to be set in Jenkin's global configuration
- Enable artifact list
- Enables the listing of the artifacts generated by the build
- Enable version info in footer
- Adds the "Jenkins version, Discord Webhook version" text in the footer of the message
Pipeline
Discord Notifier supports Jenkins Pipeline. The only required parameter is webhookURL (the URL of the webhook, of course) - but there isn't much point of sending nothing.
Parameters
- webhookURL (required)
- The URL of the webhook (pretty self-explanatory) provided by Discord.
- title
- link
- If set, the title becomes a link to this URL.
- thumbnail
- If set, the image under the URL shows up on the right side of Discord message.
- image
- If set, the image under the URL shows up under discord message
- description
- footer
- The text in footer of the message.
- successful
- True makes the left-hand side of the embed green, false sets it to red.
Example
pipeline {
agent any
post {
always {
discordSend description: 'Jenkins Pipeline Build', footer: 'Footer Text', link: env.BUILD_URL, result: currentBuild.currentResult, unstable: false, title: JOB_NAME, webhookURL: 'Webhook URL'
}
}
}