Use the Jenkins 2.0 multi-density inconvenience notification plugin

I don’t know how to set up a lock notification plugin on a multi-channel pipeline. There is no “Post-Build Actions” section on the configuration page.

+4
source share
3 answers

Stash Notifier now supports Pipelines since version 1.11.

From the examples in README :

node {
    step([$class: 'StashNotifier'])         // Notifies the Stash 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!
    }

    step([$class: 'StashNotifier'])         // Notifies the Stash Instance of the build result
}

, currentBuild.result "! Important!", , , . , sh "false", try/catch, sh . , /.

+4

, - .

, Abhijeet Kamble , http curl .

- :

withCredentials([[$class          : 'UsernamePasswordMultiBinding', credentialsId: "$env.componentCredentialsId",
          usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
   writeFile file: 'build.json', text: "{\"state\": \"SUCCESSFUL\", \"key\": \"${env.JOB_NAME}\", \"name\": \"${env.BUILD_TAG}\", \"url\": \"${env.BUILD_URL}\"}"
   sh '''curl -u $USERNAME:$PASSWORD -H "Content-Type: application/json" -X POST $URL -d @build.json'''
}

, , , .

+1

Stash Notifier, - Jenkins.

Jenkins " ", " " " Stash". URL- Stash, e. g. http://localhost:7990 or http://my.company/stash.

, Stash URL- . URL http://georg@localhost:7991/projects e. . URL- , http://localhost:7991. Credentials stash.

0

All Articles