Skip to content

Commit

Permalink
Updating doc #65
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasbjerre committed Aug 7, 2018
1 parent 3b52bbc commit d1f05cf
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Generic Webhook Plugin Changelog
Changelog of Generic Webhook Plugin.
## Unreleased
### GitHub [#65](https://github.com/jenkinsci/generic-webhook-trigger-plugin/issues/65) [Question] Multibranch pipeline trigger specific branch/pr job possibility

**Updating doc #65**


[c29909e607270bf](https://github.com/jenkinsci/generic-webhook-trigger-plugin/commit/c29909e607270bf) Tomas Bjerre *2018-08-07 11:05:35*


## 1.40 (2018-07-10 12:21:16)
### GitHub [#62](https://github.com/jenkinsci/generic-webhook-trigger-plugin/issues/62) NullPointerException when trying to trigger job

Expand Down
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ There is an optional feature to trigger jobs only if a supplied regular expressi
}
```

Then you can have a variable, resolved from post content, named `reference` of type `JSONPath` and with expression like `$.ref` . The optional filter text can be set to `$reference` and the filter regexp set to [^(refs/heads/develop|refs/heads/feature/.+)$](https://jex.im/regulex/#!embed=false&flags=&re=%5E(refs%2Fheads%2Fdevelop%7Crefs%2Fheads%2Ffeature%2F.%2B)%24) to trigger builds only for develop and feature-branches.
Then you can have a variable, resolved from post content, named `ref` of type `JSONPath` and with expression like `$.ref` . The optional filter text can be set to `$ref` and the filter regexp set to [^(refs/heads/develop|refs/heads/feature/.+)$](https://jex.im/regulex/#!embed=false&flags=&re=%5E(refs%2Fheads%2Fdevelop%7Crefs%2Fheads%2Ffeature%2F.%2B)%24) to trigger builds only for develop and feature-branches.

There are more [examples of use cases here](src/test/resources/org/jenkinsci/plugins/gwt/bdd).

Expand Down Expand Up @@ -53,7 +53,7 @@ When using the plugin in several jobs, you will have the same URL trigger all jo

## Authentication

There is a special `token` parameter. When supplied, it is used with [BuildAuthorizationToken](http://javadoc.jenkins-ci.org/hudson/model/BuildAuthorizationToken.html) to authenticate.
There is a special `token` parameter. When supplied, it is used with [Build Token Root Plugin](https://wiki.jenkins.io/display/JENKINS/Build+Token+Root+Plugin) to authenticate.

![Parameter](https://github.com/jenkinsci/generic-webhook-trigger-plugin/blob/master/sandbox/configure-token.png)

Expand Down Expand Up @@ -165,7 +165,7 @@ node {
pipelineTriggers([
[$class: 'GenericTrigger',
genericVariables: [
[key: 'reference', value: '$.ref'],
[key: 'ref', value: '$.ref'],
[
key: 'before',
value: '$.before',
Expand All @@ -182,18 +182,20 @@ node {
[key: 'headerWithNumber', regexpFilter: '[^0-9]'],
[key: 'headerWithString', regexpFilter: '']
],
printContributedVariables: true,
printPostContent: true,
regexpFilterText: '',
regexpFilterExpression: ''
regexpFilterText: '$ref',
regexpFilterExpression: 'refs/heads/' + BRANCH_NAME
]
])
])
stage("build") {
sh '''
echo Variables from shell:
echo reference $reference
echo ref $ref
echo before $before
echo requestWithNumber $requestWithNumber
echo requestWithString $requestWithString
Expand All @@ -216,8 +218,12 @@ pipeline {
causeString: 'Triggered on $ref',
regexpFilterExpression: '',
regexpFilterText: '',
printContributedVariables: true,
printPostContent: true
printPostContent: true,
regexpFilterText: '$ref',
regexpFilterExpression: 'refs/heads/' + BRANCH_NAME
)
}
stages {
Expand All @@ -243,7 +249,7 @@ Contributing variables:
headerWithString_0 = a b c
requestWithNumber_0 = 123
reference = refs/heads/develop
ref = refs/heads/develop
headerWithNumber = 123
requestWithNumber = 123
before = 1848f12
Expand Down

0 comments on commit d1f05cf

Please sign in to comment.