Skip to content

Commit

Permalink
Adding declarative example
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasbjerre committed May 5, 2018
1 parent 6251d76 commit 23e3e03
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 3 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
### No issue

**Adding declarative example**


[ed551dea8d774bc](https://github.com/jenkinsci/generic-webhook-trigger-plugin/commit/ed551dea8d774bc) Tomas Bjerre *2018-05-05 20:05:30*


## 1.33 (2018-05-05 19:13:39)
### GitHub [#47](https://github.com/jenkinsci/generic-webhook-trigger-plugin/issues/47) Declarative Pipeline support *enhancement*

Expand Down
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ echo $requestHeaderName

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:

With a Jenkinsfile like this:
With a scripted Jenkinsfile like this:

```groovy
node {
Expand Down Expand Up @@ -204,6 +204,32 @@ node {
}
```

With a declarative Jenkinsfile like this:
```groovy
pipeline {
agent any
triggers {
GenericTrigger(
genericVariables: [
[key: 'ref', value: '$.ref']
],
causeString: 'Triggered on $ref',
regexpFilterExpression: '',
regexpFilterText: '',
printContributedVariables: true,
printPostContent: true
)
}
stages {
stage('Some step') {
steps {
sh "echo $ref"
}
}
}
}
```

It can be triggered with something like:

```bash
Expand Down
22 changes: 22 additions & 0 deletions sandbox/declarative.jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
pipeline {
agent any
triggers {
GenericTrigger(
genericVariables: [
[key: 'ref', value: '$.ref']
],
causeString: 'Triggered on $ref',
regexpFilterExpression: '',
regexpFilterText: '',
printContributedVariables: true,
printPostContent: true
)
}
stages {
stage('Some step') {
steps {
sh "echo $ref"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
Is triggered by HTTP POST requests to http://JENKINS_URL/generic-webhook-trigger/invoke
</p>
<p>
You may can fiddle with JSONPath <a href="https://jsonpath.curiousconcept.com/">here</a>. You may also want to checkout the syntax <a href="https://github.com/jayway/JsonPath">here</a>.
You can fiddle with JSONPath <a href="https://jsonpath.curiousconcept.com/">here</a>. You may also want to checkout the syntax <a href="https://github.com/jayway/JsonPath">here</a>.
</p>
<p>
You may can fiddle with XPath <a href="http://www.freeformatter.com/xpath-tester.html">here</a>. You may also want to checkout the syntax <a href="https://www.w3schools.com/xml/xpath_syntax.asp">here</a>.
You can fiddle with XPath <a href="http://www.freeformatter.com/xpath-tester.html">here</a>. You may also want to checkout the syntax <a href="https://www.w3schools.com/xml/xpath_syntax.asp">here</a>.
</p>
</div>

0 comments on commit 23e3e03

Please sign in to comment.