Reputation: 67
Preconditions: Add a webhook in my repository:
http://JenkinsURL:Port/multibranch-webhook-trigger/invoke?token=myToken
triggers {
GenericTrigger(
genericVariables:[
//some variables
],
token: 'myToken',
//some configurations
)
}
stages{
// ...
}
Push from repository -> not build -> not expected behavior, seems token
not work here
I wonder what the difference of these 2 tokens and how I should use token in jenkinsfile
I get the explations, see my answer below. If any one knows how we can use Multibranch webhook in triggers
Upvotes: 0
Views: 592
Reputation: 67
I got the point: There're 2 webhook plugins:
JENKINS_URL/generic-webhook-trigger/invoke?token=GenericToken
. It can be used in Build Trigger in Freestyle project, Pipeline or other project... It also can be added in triggers
block in jenkinsfile.JENKINS_URL/multibranch-webhook-trigger/invoke?token=MultibranchToken
and can be configured in Build Configuration in Multibranch Pipeline.
I don't know if we can use Multibranch Scan Webhook Trigger in jenkinsfile.Back to my question, I use Generic Webhook Trigger in triggers
block, but send Multibranch webhook trigger from HTTP request. That's why it doesn't work.
Upvotes: 1