All Projects → jenkinsci → Stashnotifier Plugin

jenkinsci / Stashnotifier Plugin

Licence: other
A Jenkins Plugin to notify Atlassian Stash|Bitbucket of build results

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Stashnotifier Plugin

Pipeline Aws Plugin
Jenkins Pipeline Step Plugin for AWS
Stars: ✭ 389 (+147.77%)
Mutual labels:  jenkins, jenkins-plugin
Sonar Scanner Jenkins
SonarQube Scanner for Jenkins
Stars: ✭ 155 (-1.27%)
Mutual labels:  jenkins, jenkins-plugin
Docker Workflow Plugin
Jenkins plugin which allows building, testing, and using Docker images from Jenkins Pipeline projects.
Stars: ✭ 419 (+166.88%)
Mutual labels:  jenkins, jenkins-plugin
calendar-view-plugin
Jenkins Calendar View Plugin: Shows past and future builds in a calendar view
Stars: ✭ 17 (-89.17%)
Mutual labels:  jenkins, jenkins-plugin
Role Strategy Plugin
Jenkins Role-Strategy plugin
Stars: ✭ 91 (-42.04%)
Mutual labels:  jenkins, jenkins-plugin
Skyhook
Parses webhooks and forwards them in the proper format to Discord.
Stars: ✭ 263 (+67.52%)
Mutual labels:  jenkins, bitbucket
Jenkins Os
Groovy pipeline jobs that build and test Container Linux with Jenkins
Stars: ✭ 43 (-72.61%)
Mutual labels:  jenkins, jenkins-plugin
github-api-plugin
This plugin packages stock github-api library
Stars: ✭ 20 (-87.26%)
Mutual labels:  jenkins, jenkins-plugin
Jira Steps Plugin
Jenkins pipeline steps for integration with JIRA.
Stars: ✭ 88 (-43.95%)
Mutual labels:  jenkins, jenkins-plugin
Envinject Plugin
This plugin makes it possible to setup a custom environment for your jobs
Stars: ✭ 74 (-52.87%)
Mutual labels:  jenkins, jenkins-plugin
parameterized-trigger-plugin
Jenkins parameterized-trigger plugin
Stars: ✭ 63 (-59.87%)
Mutual labels:  jenkins, jenkins-plugin
Swarm Plugin
Jenkins swarm plugin
Stars: ✭ 114 (-27.39%)
Mutual labels:  jenkins, jenkins-plugin
pipeline-maven-plugin
Pipeline Maven Plugin
Stars: ✭ 50 (-68.15%)
Mutual labels:  jenkins, jenkins-plugin
Generic Webhook Trigger Plugin
Can receive any HTTP request, extract any values from JSON or XML and trigger a job with those values available as variables. Works with GitHub, GitLab, Bitbucket, Jira and many more.
Stars: ✭ 287 (+82.8%)
Mutual labels:  jenkins-plugin, bitbucket
pm2-githook
receive webhook from github/gitlab and ask pm2 to reload the application for you
Stars: ✭ 39 (-75.16%)
Mutual labels:  jenkins, bitbucket
Dashboard
📺 Create your own team dashboard with custom widgets. Built with Next.js, React, styled-components and polished.
Stars: ✭ 1,007 (+541.4%)
Mutual labels:  jenkins, bitbucket
custom-tools-plugin
A generic tool installer for Jenkins
Stars: ✭ 25 (-84.08%)
Mutual labels:  jenkins, jenkins-plugin
docker-commons-plugin
API plugin, which provides the common shared functionality for various Docker-related plugins.
Stars: ✭ 38 (-75.8%)
Mutual labels:  jenkins, jenkins-plugin
Simple Theme Plugin
A simple theme plugin for Jenkins
Stars: ✭ 45 (-71.34%)
Mutual labels:  jenkins, jenkins-plugin
Butler
Export/Import Jenkins jobs & plugins 📤
Stars: ✭ 113 (-28.03%)
Mutual labels:  jenkins, jenkins-plugin

Bitbucket Server Notifier Plugin for Jenkins

This Jenkins plugin notifies Bitbucket Server (formerly known as Stash) of build results. Failed or successful builds will show up as little icons in Bitbucket's web interface in commit logs. Clicking on such an icon will take the user to the specific build.

Requirements

This plugin uses the Atlassian Stash / Bitbucket Server Build REST API.

Setup

Set up Bitbucket Server Notifier by navigating to Manage Jenkins --> Configure System and scrolling down to the Bitbucket Server Notifier section. Enter at least your Server base URL and Credentials. Additional options are available as required.

Bitbucket Server Notifier Settings

Script setup

Either automatically upon Jenkins post-initialization or through Jenkins Script Console, example:

Jenkins
    .instance
    .getDescriptor('org.jenkinsci.plugins.stashNotifier.StashNotifier')
    .with{
        credentialsId = 'bitbucket-creds'
        stashRootUrl = 'https://my.company.intranet/bitbucket'
        ignoreUnverifiedSsl = true
        disableInprogressNotification = true
        includeBuildNumberInKey = false
        prependParentProjectKey = false
        considerUnstableAsSuccess = false
    }

Usage

Use the Bitbucket Server Notifier by adding it as a Post Step in your Jenkins build job configuration.

  1. In your Jenkins job configuration go to the Post-build Actions section, click on Add post-build action and select Notify Bitbucket Instance.
  2. Enter the Server base URL, e. g. http://localhost:7990 or https://my.company.intranet/bitbucket.
    If in doubt, go to your local Bitbucket server and check the URL in the browser. The URL http://[email protected]:7991/projects e. g. reveals the server base URL, which is http://localhost:7991 in this case.
  3. Select the Credentials for authenticating with Bitbucket.
    Please note that SSH credentials (public/private key) from Jenkins that might be added to Bitbucket are not used for the authentication. Typically, in order to access Bitbucket you would add a service account (username and password) to Jenkins.

That's it. If you have configured everything correctly, Jenkins will notify your Bitbucket instance of subsequent builds. The result is illustrated on the Atlassian Bitbucket Build Integration wiki page.

Note on Pipeline Plugin usage

See the following code for an example of how to use this plugin inside of a Pipeline. You must set the result of the current build manually in the Pipeline script.

node {
    checkout scm                            // Necessary so we know the current commit

    notifyBitbucket()                       // Notifies the Bitbucket instance of an INPROGRESS build

    try {
        // Do stuff

        currentBuild.result = 'SUCCESS'     // Set result of currentBuild !Important!
    } catch(err) {
        currentBuild.result = 'FAILED'      // Set result of currentBuild !Important!
    }

    notifyBitbucket()                       // Notifies the Bitbucket instance of the build result
}

Or you could as well use

    checkout scm
    
    notifyBitbucket(buildStatus: 'INPROGRESS')        // Notifies the Bitbucket instance of an INPROGRESS build
    
    try {
        // Do stuff
        notifyBitbucket(buildStatus: 'SUCCESSFUL')    // Notifies the Bitbucket instance of an SUCCESSFUL build
    } catch(err) {
        // Do clean up
        notifyBitbucket(buildStatus: 'FAILED')        // Notifies the Bitbucket instance of an FAILED build
    }

In situations where an advanced setup is required the following can be used:

node {
    this.notifyBitbucket('INPROGRESS')     // Notifies the Bitbucket instance of an INPROGRESS build

    try {
        // Do stuff

        this.notifyBitbucket('SUCCESS')
    } catch(err) {
        this.notifyBitbucket('FAILED')
    }
}

def notifyBitbucket(String state) {
    notifyBitbucket(
            commitSha1: 'commit',
            credentialsId: '00000000-1111-2222-3333-123456789abc',
            disableInprogressNotification: false,
            considerUnstableAsSuccess: true,
            ignoreUnverifiedSSLPeer: true,
            buildStatus: state,
            buildName: 'Performance Testing',
            includeBuildNumberInKey: false,
            prependParentProjectKey: false,
            projectKey: '',
            stashServerBaseUrl: 'https://my.company.intranet/bitbucket')

}

In Declarative Pipelines, where Jenkins sets currentBuild.result = null for SUCCESS builds, the current value can be modified via a script step, e.g.:

pipeline {
    agent any
    stages {
        stage('Build') {
            steps {
                echo 'Hello World'
                // currentBuild.result == null here
            }
        }
    }
    post {
        always {
            script {
                currentBuild.result = currentBuild.result ?: 'SUCCESS'
                notifyBitbucket()
            }
        }
    }
}

Note on credentials

Currently Bitbucket Server Build Notifier accepts only raw plaintext credentials as it uses the HTTP REST API of Bitbucket.

Maintainers

License

Apache 2.0 License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].