jenkins-msteams-notification

1.0.6 • Public • Published

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

image

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.6
    1
    • latest

Version History

Package Sidebar

Install

npm i jenkins-msteams-notification

Weekly Downloads

1

Version

1.0.6

License

MIT

Unpacked Size

5.77 kB

Total Files

7

Last publish

Collaborators

  • rouanw