Reputation: 1154
I have followed the link given below to trigger my jenkins pipeline job only when a push occurs on master branch. https://wiki.jenkins.io/display/JENKINS/Generic+Webhook+Trigger+Plugin
To filter according to the payload 'ref' tag, optional filter is set in jenkins pipeline job.
Then i applied optional filter on 'ref' variable, to allow only master branch
Finally a token filter is added, that is unique to my repository
Token filter works as expected, but the filter on ref variable is not having any impact on the pipeline job. Job will be triggered irrespective of what value is given on the regular expression.
Eg. Job is getting triggered even if I delete a tag!
I am not able to understand this behavior, neither I think that I am missing something in the configuration. Your help will be highly appreciated.
Upvotes: 3
Views: 4995
Reputation: 1324347
Since you are using a token, that might explain why the job is always triggered:
Trigger only specific job
When using the plugin in several jobs, you will have the same URL trigger all jobs. If you want to trigger only a certain job you can:
- Use the token-parameter and have different tokens for different jobs. Using only the token means only jobs with that exact token will be visible for that request. This will increase performance and reduce responses of each invocation.
In your case, try and use only the un:pw
(username/password) in your URL, without a token, to see of your Optional Filter applies.
Upvotes: 1