Skip to content

Commit

Permalink
doc
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasbjerre committed Jul 28, 2017
1 parent f494121 commit 8eacab3
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 4 deletions.
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,16 @@ echo $VARIABLE_FROM_HEADER

## Pipeline

This plugin can be used with the [Pipeline Multibranch Plugin](https://jenkins.io/doc/pipeline/steps/workflow-multibranch/#properties-set-job-properties):
This plugin can be used with the [Pipeline Multibranch Plugin](https://jenkins.io/doc/pipeline/steps/workflow-multibranch/#properties-set-job-properties). Here is an example:

```
node {
properties([
pipelineTriggers([
[$class: 'GenericTrigger',
genericVariables: [
[expressionType: 'JSONPath', key: 'variable1', value: 'expression1'],
[expressionType: 'JSONPath', key: 'variable2', value: 'expression2']
[expressionType: 'JSONPath', key: 'reference', value: '$.ref'],
[expressionType: 'JSONPath', key: 'before', value: '$.before']
],
regexpFilterText: '',
regexpFilterExpression: ''
Expand All @@ -146,12 +146,18 @@ node {
stage("build") {
sh '''
echo Build
echo Build $reference before $before
'''
}
}
```

It can be triggered with something like:

```
curl -X POST -H "Content-Type: application/json" -d '{ "before": "1848f12", "after": "5cab1", "ref": "refs/heads/develop" }' -vs http://admin:admin@localhost:8080/jenkins/generic-webhook-trigger/invoke
```

## Plugin development
More details on Jenkins plugin development is available [here](https://wiki.jenkins-ci.org/display/JENKINS/Plugin+tutorial).

Expand Down
23 changes: 23 additions & 0 deletions sandbox/multibranch.jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* curl -X POST -H "Content-Type: application/json" -d '{ "before": "1848f12", "after": "5cab1", "ref": "refs/heads/develop" }' -vs http://admin:admin@localhost:8080/jenkins/generic-webhook-trigger/invoke
*/
node {
properties([
pipelineTriggers([
[$class: 'GenericTrigger',
genericVariables: [
[expressionType: 'JSONPath', key: 'reference', value: '$.ref'],
[expressionType: 'JSONPath', key: 'before', value: '$.before']
],
regexpFilterText: '',
regexpFilterExpression: ''
]
])
])

stage("build") {
sh '''
echo Build $reference before $before
'''
}
}

0 comments on commit 8eacab3

Please sign in to comment.