jenkins-msteams-notification
v1.0.6
Published
Simple webhook wrapper that uses Jenkins build environment variables to send build failure notifications to channels on Microsoft Teams
Downloads
8
Maintainers
Readme
Microsoft Teams Notifications for your failing Jenkins Build
Simple, zero-dependency, webhook wrapper that uses Jenkins build environment variables to send build failure notifications to channels on Microsoft Teams
Usage
MSTEAMS_WEBHOOK_URL=<webhook-url> npm_config_yes=true npx jenkins-msteams-notification
Where webhook-url
is a URL you create in MS Teams for the channel you'd like to notify. You can check the Microsoft Documentation to see how to do that.
Example
This is ideal to include in the post
section of your Jenkins pipeline. You'll need to ensure that the code is executed on an agent with node
and npx
available.
You might add something like this to your Jenkins pipeline:
environment {
MSTEAMS_WEBHOOK_URL = '<url you got from the Teams client>'
}
// ... your stages, etc.
post {
failure {
container('node') {
script {
if (env.BRANCH_NAME == 'main')
sh "npm_config_yes=true npx jenkins-msteams-notification"
}
}
}
}
Scope
Currently hardcoded to report a failure and has only been tested with code hosted on GitHub.
License
MIT