README: example of trigger configuration for multibranch jobs
Replaces #684.
This commit is contained in:
parent
84e808632c
commit
acaab4d405
34
README.md
34
README.md
|
@ -220,6 +220,40 @@ node {
|
|||
### Pipeline Multibranch jobs
|
||||
Unlike other job types, there is no 'Trigger' setting required for a Multibranch job configuration; just create a webhook in GitLab for push requests which points to ``http://JENKINS_URL/project/PROJECT_NAME`` or ``http://JENKINS_URL/project/FOLDER/PROJECT_NAME`` if the project in inside a folder in Jenkins. When GitLab POSTs to this URL, it will trigger branch indexing for the Jenkins project, and Jenkins will handle starting any builds necessary.
|
||||
|
||||
If you want to configure some of the trigger options, such as the secret token or CI skip functionality, you can use a `properties` step. For example:
|
||||
|
||||
```
|
||||
// Define your secret project token here
|
||||
def project_token = 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEF'
|
||||
|
||||
// Reference the GitLab connection name from your Jenkins Global configuration (http://JENKINS_URL/configure, GitLab section)
|
||||
properties([
|
||||
gitLabConnection('your-gitlab-connection-name'),
|
||||
pipelineTriggers([
|
||||
[
|
||||
$class: 'GitLabPushTrigger',
|
||||
branchFilterType: 'All',
|
||||
triggerOnPush: true,
|
||||
triggerOnMergeRequest: false,
|
||||
triggerOpenMergeRequestOnPush: "never",
|
||||
triggerOnNoteRequest: true,
|
||||
noteRegex: "Jenkins please retry a build",
|
||||
skipWorkInProgressMergeRequest: true,
|
||||
secretToken: project_token
|
||||
ciSkip: false,
|
||||
setBuildDescription: true,
|
||||
addNoteOnMergeRequest: true,
|
||||
addCiMessage: true,
|
||||
addVoteOnMergeRequest: true,
|
||||
acceptMergeRequestOnSuccess: false,
|
||||
branchFilterType: "NameBasedFilter",
|
||||
includeBranchesSpec: "release/qat",
|
||||
excludeBranchesSpec: "",
|
||||
]
|
||||
])
|
||||
])
|
||||
```
|
||||
|
||||
## Build status configuration
|
||||
You can optionally have your Jenkins jobs send their build status back to GitLab, where it will be displayed in the commit or merge request UI as appropriate.
|
||||
|
||||
|
|
Loading…
Reference in New Issue