Add 'secret-token' parameter to gitlab trigger

This adds support for the job specific secret token in the
gitlab build trigger.

This feature was added to the "Gitlab Plugin" with version 1.4.1
(released Sep 24, 2016).
Excerpt from the changelog:
 "Add possiblity to configure secret tokens per job to allow
  only web hooks with the correct token to trigger builds."

Change-Id: Id1ede4a6a51a231f60a39bfaefbadd8f849076e4
This commit is contained in:
Norbert Grünwald 2018-10-10 15:01:47 +02:00 committed by Thanh Ha (zxiiro)
parent 539d13e816
commit 1ee893d595
10 changed files with 12 additions and 1 deletions

View File

@ -1332,6 +1332,7 @@ def gitlab(registry, xml_parent, data):
:arg list exclude-branches: Defined list of branches to exclude
(default [])
:arg str target-branch-regex: Regular expression to select branches
:arg str secret-token: Secret token for build trigger
.. _`branch filter type`:
@ -1434,7 +1435,8 @@ def gitlab(registry, xml_parent, data):
False),
('add-ci-message', 'addCiMessage', False),
('allow-all-branches', 'allowAllBranches', False),
('target-branch-regex', 'targetBranchRegex', '')
('target-branch-regex', 'targetBranchRegex', ''),
('secret-token', 'secretToken', '')
]
list_mapping = (

View File

@ -20,6 +20,7 @@
<addCiMessage>true</addCiMessage>
<allowAllBranches>true</allowAllBranches>
<targetBranchRegex/>
<secretToken/>
<includeBranchesSpec>master, master2, local-test</includeBranchesSpec>
<excludeBranchesSpec>broken-test, master-foo</excludeBranchesSpec>
</com.dabsquared.gitlabjenkins.GitLabPushTrigger>

View File

@ -20,6 +20,7 @@
<addCiMessage>false</addCiMessage>
<allowAllBranches>false</allowAllBranches>
<targetBranchRegex/>
<secretToken/>
<includeBranchesSpec>master</includeBranchesSpec>
<excludeBranchesSpec>feature</excludeBranchesSpec>
</com.dabsquared.gitlabjenkins.GitLabPushTrigger>

View File

@ -20,6 +20,7 @@
<addCiMessage>false</addCiMessage>
<allowAllBranches>false</allowAllBranches>
<targetBranchRegex/>
<secretToken/>
<includeBranchesSpec>master</includeBranchesSpec>
<excludeBranchesSpec>baz, foo, fnord</excludeBranchesSpec>
</com.dabsquared.gitlabjenkins.GitLabPushTrigger>

View File

@ -20,6 +20,7 @@
<addCiMessage>true</addCiMessage>
<allowAllBranches>true</allowAllBranches>
<targetBranchRegex/>
<secretToken/>
<includeBranchesSpec>master, master2, local-test</includeBranchesSpec>
<excludeBranchesSpec>broken-test, master-foo</excludeBranchesSpec>
</com.dabsquared.gitlabjenkins.GitLabPushTrigger>

View File

@ -20,6 +20,7 @@
<addCiMessage>false</addCiMessage>
<allowAllBranches>false</allowAllBranches>
<targetBranchRegex/>
<secretToken/>
<includeBranchesSpec/>
<excludeBranchesSpec/>
</com.dabsquared.gitlabjenkins.GitLabPushTrigger>

View File

@ -20,6 +20,7 @@
<addCiMessage>true</addCiMessage>
<allowAllBranches>false</allowAllBranches>
<targetBranchRegex>(.*debug.*|.*release.*)</targetBranchRegex>
<secretToken>secret-build-token</secretToken>
<includeBranchesSpec>include1, include2</includeBranchesSpec>
<excludeBranchesSpec>exclude1, exclude2</excludeBranchesSpec>
</com.dabsquared.gitlabjenkins.GitLabPushTrigger>

View File

@ -20,3 +20,4 @@ triggers:
- exclude1
- exclude2
target-branch-regex: '(.*debug.*|.*release.*)'
secret-token: 'secret-build-token'

View File

@ -20,6 +20,7 @@
<addCiMessage>true</addCiMessage>
<allowAllBranches>true</allowAllBranches>
<targetBranchRegex/>
<secretToken/>
<includeBranchesSpec>master, master2, local-test</includeBranchesSpec>
<excludeBranchesSpec>broken-test, master-foo</excludeBranchesSpec>
</com.dabsquared.gitlabjenkins.GitLabPushTrigger>

View File

@ -20,6 +20,7 @@
<addCiMessage>true</addCiMessage>
<allowAllBranches>false</allowAllBranches>
<targetBranchRegex/>
<secretToken/>
<includeBranchesSpec/>
<excludeBranchesSpec/>
</com.dabsquared.gitlabjenkins.GitLabPushTrigger>