GitHub Pull Request Trigger Plugin with configure blocks.

69 views
Skip to first unread message

jim...@gmail.com

unread,
Aug 8, 2017, 6:25:06 AM8/8/17
to job-dsl-plugin
Hi all.

I'm having a lot of problems trying to configure the non standard pull request trigger plugin using configure blocks, this is the XML i need to build up using the configure blocks:

<triggers>
 
<org.jenkinsci.plugins.github.pullrequest.GitHubPRTrigger plugin="github-pu...@0.1.0-rc25">
   
<spec/>
   
<triggerMode>HEAVY_HOOKS</triggerMode>
   
<cancelQueued>true</cancelQueued>
   
<abortRunning>true</abortRunning>
   
<skipFirstRun>false</skipFirstRun>
   
<repoProviders>
     
<com.github.kostyasha.github.integration.generic.repoprovider.GitHubPluginRepoProvider>
       
<cacheConnection>true</cacheConnection>
       
<manageHooks>true</manageHooks>
       
<repoPermission>ADMIN</repoPermission>
     
</com.github.kostyasha.github.integration.generic.repoprovider.GitHubPluginRepoProvider>
   
</repoProviders>
   
<errorsAction>
     
<description>GitHub Pull Requests Trigger Errors</description>
     
<errors class="java.util.Collections$SynchronizedSet" serialization="custom">
       
<java.util.Collections_-SynchronizedCollection>
         
<default>
           
<c class="set"/>
           
<mutex class="java.util.Collections$SynchronizedSet" reference="../../.."/>
         
</default>
       
</java.util.Collections_-SynchronizedCollection>
     
</errors>
   
</errorsAction>
   
<events>
     
<org.jenkinsci.plugins.github.pullrequest.events.impl.GitHubPROpenEvent/>
     
<org.jenkinsci.plugins.github.pullrequest.events.impl.GitHubPRCommentEvent>
       
<comment>verify</comment>
     
</org.jenkinsci.plugins.github.pullrequest.events.impl.GitHubPRCommentEvent>
   
</events>
   
<preStatus>true</preStatus>
 
</org.jenkinsci.plugins.github.pullrequest.GitHubPRTrigger>
</triggers>

I was unable to add nodes with classes references and and some attributes for example: <errors class="java.util.Collections$SynchronizedSet" serialization="custom">.

Also i've got problems with autclosing nodes (in wich the node itselfs append an slash to close it:
<org.jenkinsci.plugins.github.pullrequest.events.impl.GitHubPROpenEvent/>

Here is my attempt to do it using configure:

triggers {
    configure
{ node ->
        node
/ 'triggers' << 'org.jenkinsci.plugins.github.pullrequest.GitHubPRTrigger'(plugin: "github-pu...@0.1.0-rc25") {
            triggerMode
'HEAVY_HOOKS'
            cancelQueued
'true'
            abortRunning
'true'
            skipFirstRun
'false'
            repoProviders
{
               
'com.github.kostyasha.github.integration.generic.repoprovider.GitHubPluginRepoProvider' {
                    cacheConnection
'true'
                    manageHooks
'true'
                    repoPermission
'ADMIN'
               
}
           
}
            errorsAction
{
               
delegate.description 'GitHub Pull Requests Trigger Errors'
                node
/ 'errors' (class: 'java.util.Collections$SynchronizedSet') {
                   
'java.util.Collections_-SynchronizedCollection' {
                       
'default' {
                            node
/ 'mutex' (class: 'java.util.Collections$SynchronizedSet')
                       
}
                   
}
               
}
           
}
            node
/ 'events' << 'org.jenkinsci.plugins.github.pullrequest.events.impl.GitHubPROpenEvent' {
           
}
       
}
   
}
}

Any help with that will be much appreciated. Thanks in advance.

Cheers.

Daniel Spilker

unread,
Aug 30, 2017, 3:03:27 PM8/30/17
to job-dsl...@googlegroups.com
The nodevariable reference the top-level XML element. By using node / 'events' you append the events node to the top-level node. Remove node / to add the element to the current level.

To create an empty element add brackets, e.g. 'org.jenkinsci.plugins.github.pullrequest.events.impl.GitHubPROpenEvent'(). Note that <a/> and <a></a> is equivalent in XML.

Example for creating an element with multiple attributes and nested elements:

      errors(class: 'java.util.Collections$SynchronizedSet', serialization: 'custom') {
        moreElements()
      }

Daniel

On Tue, Aug 8, 2017 at 12:25 PM, <jim...@gmail.com> wrote:
Hi all.

I'm having a lot of problems trying to configure the non standard pull request trigger plugin using configure blocks, this is the XML i need to build up using the configure blocks:

<triggers>
 
<org.jenkinsci.plugins.github.pullrequest.GitHubPRTrigger plugin="github-pullrequest@0.1.0-rc25">

--
You received this message because you are subscribed to the Google Groups "job-dsl-plugin" group.
To unsubscribe from this group and stop receiving emails from it, send an email to job-dsl-plugin+unsubscribe@googlegroups.com.
To post to this group, send email to job-dsl-plugin@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/job-dsl-plugin/7f0733a9-761f-4198-9c7d-1d7a824a51c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages