Skip to content

Commit

Permalink
Update readme.md (#121)
Browse files Browse the repository at this point in the history
* Update readme.md

added real case example of how to use this plugin with Jenkins' Pipelines
  • Loading branch information
sdmoralesma authored and scaytrase committed Aug 16, 2016
1 parent 46d412f commit 2b0f446
Showing 1 changed file with 36 additions and 3 deletions.
39 changes: 36 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,52 @@ current build manually in the Pipeline script.
```groovy
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
}
```

In situations where an advanced setup is required the following can be used:
```groovy
node {
this.notifyStash('INPROGRESS') // Notifies the Stash Instance of an INPROGRESS build
try {
// Do stuff
this.notifyStash('SUCCESS')
} catch(err) {
this.notifyStash('FAILED')
}
}
def notifyStash(String state) {
if('SUCCESS' == state || 'FAILED' == state) {
currentBuild.result = state // Set result of currentBuild !Important!
}
step([$class: 'StashNotifier',
commitSha1: "$commit", // jenkins parameter that resolves to commit's hash
credentialsId: '00000000-1111-2222-3333-123456789abc',
disableInprogressNotification: false,
ignoreUnverifiedSSLPeer: true,
includeBuildNumberInKey: false,
prependParentProjectKey: false,
projectKey: '',
stashServerBaseUrl: 'https://stash.company.com'])
}
```

### Note on credentials

Currently Stash Build Notifier Plugin accepts only raw plaintext credentials as it work over HTTP REST API of stash
Expand Down

0 comments on commit 2b0f446

Please sign in to comment.