Generated Gitlab Push Trigger doesn't work unless saved through UI

695 views
Skip to first unread message

ZT

unread,
Dec 16, 2016, 12:36:02 PM12/16/16
to job-dsl-plugin
Hello,

I am configuring the Gitlab Push Trigger  using the automatically generated DSL, the DSL seems to generate the configuration XML file , but the webhook from Gitlab does not fire the job. It fails with an HTTP 500 error 

When i open the job configuration to edit, make no changes, and save it again through the UI..retry the hook ..it works...

Here is my DSL

gitLabPushTrigger {
triggerOnPush(true)
triggerOnMergeRequest(false)
triggerOpenMergeRequestOnPush('never')
triggerOnNoteRequest(false)
noteRegex('')
skipWorkInProgressMergeRequest(true)
ciSkip(false)
setBuildDescription(true)
addNoteOnMergeRequest(false)
addCiMessage(false)
addVoteOnMergeRequest(false)
acceptMergeRequestOnSuccess(false)
branchFilterType('NameBasedFilter')
includeBranchesSpec(repoBranchName)
excludeBranchesSpec('')
targetBranchRegex('')
mergeRequestLabelFilterConfig {
include('')
exclude('')
}
secretToken(HashGenerator.generate(jobName))
}

I began to compare the XML snippets (of the trigger section), generated by Job DSL and after having saved it through the UI

Original (Generated by Job DSL)

<riggers class="vector">
<com.dabsquared.gitlabjenkins.GitLabPushTrigger plugin="gitlab...@1.4.3">
<spec/>
<triggerOnPush>
true
</triggerOnPush>
<triggerOnMergeRequest>
false
</triggerOnMergeRequest>
<triggerOpenMergeRequestOnPush>
never
</triggerOpenMergeRequestOnPush>
<triggerOnNoteRequest>
false
</triggerOnNoteRequest>
<noteRegex/>
<ciSkip>
false
</ciSkip>
<skipWorkInProgressMergeRequest>
true
</skipWorkInProgressMergeRequest>
<setBuildDescription>
true
</setBuildDescription>
<branchFilterType>
NameBasedFilter
</branchFilterType>
<includeBranchesSpec>
develop
</includeBranchesSpec>
<excludeBranchesSpec/>
<targetBranchRegex/>
<mergeRequestLabelFilterConfig>
<include/>
<exclude/>
</mergeRequestLabelFilterConfig>
<secretToken>
nbIHZdJ2ayIOmzhXuckPwf3hWxymjSAvuKuAJXc4igemwx07RxxLj/Vdp6XQorqG
</secretToken>
</com.dabsquared.gitlabjenkins.GitLabPushTrigger>
</triggers>

 Configuration XML (After i have saved the Job through the UI with no changes)

<triggers>
<com.dabsquared.gitlabjenkins.GitLabPushTrigger plugin="gitlab...@1.4.3">
<spec/>
<triggerOnPush>
true
</triggerOnPush>
<triggerOnMergeRequest>
false
</triggerOnMergeRequest>
<triggerOpenMergeRequestOnPush>
never
</triggerOpenMergeRequestOnPush>
<triggerOnNoteRequest>
false
</triggerOnNoteRequest>
<noteRegex/>
<ciSkip>
false
</ciSkip>
<skipWorkInProgressMergeRequest>
true
</skipWorkInProgressMergeRequest>
<setBuildDescription>
true
</setBuildDescription>
<branchFilterType>
NameBasedFilter
</branchFilterType>
<includeBranchesSpec>
develop
</includeBranchesSpec>
<excludeBranchesSpec/>
<targetBranchRegex/>
<mergeRequestLabelFilterConfig>
<include/>
<exclude/>
</mergeRequestLabelFilterConfig>
<secretToken>
nbIHZdJ2ayIOmzhXuckPwf3hWxymjSAvuKuAJXc4igemwx07RxxLj/Vdp6XQorqG
</secretToken>
</com.dabsquared.gitlabjenkins.GitLabPushTrigger>
</triggers> 


The latter configuration works, the former doesn't . I do see that in the delta of the XML's, the "vector" class is removed by Jenkins on Save.

Not sure which if that is making a difference, but i am wondering if anyone has seen a similar problem before where generated DSL doesn't work but saving the configuration through UI without making changes begins to make it work.

Job DSL Version: 1.53
Jenkins Version: 2.0

Any pointers to proceed will be highly appreciated

Regards,
Rahul 


ZT

unread,
Dec 16, 2016, 4:40:30 PM12/16/16
to job-dsl-plugin
Never mind, i was missing the Gitlab Connection Property through the DSL

Apparently, when i save it through the UI - it gets added to the XML automatically when there is only one connection. 
<riggers class="vector">
<com.dabsquared.gitlabjenkins.GitLabPushTrigger plugin="gitlab-p...@1.4.3">
</triggers>
<com.dabsquared.gitlabjenkins.GitLabPushTrigger plugin="gitlab-p...@1.4.3">

Jason Laqua

unread,
Jun 22, 2017, 11:16:41 AM6/22/17
to job-dsl-plugin
Do you have an example of how and where this property should be added?
Reply all
Reply to author
Forward
0 new messages