Nick,

 There is also another google group you might find useful:
  - https://groups.google.com/forum/#!forum/job-dsl-plugin

Cheers
 
On Tuesday, 6 October 2015 10:26:44 UTC+2, Nick Stolwijk wrote:
>
> Doh... that is simpler than I thought. :D I couldn't find any examples in 
> the various Job DSL configurations I had found.
>
> Thanks for the help!
>
> Nick Stolwijk
>
> ~~~ Try to leave this world a little better than you found it and, when 
> your turn comes to die, you can die happy in feeling that at any rate you 
> have not wasted your time but have done your best ~~~
>
> Lord Baden-Powell
>
> On Tue, Oct 6, 2015 at 9:19 AM, Baptiste Mathus <[email protected] 
> <javascript:>> wrote:
>
>> Well, Job DSL is actually Groovy code. So something like the following 
>> should work:
>>
>>  scm { 
>>    if(data.git_url) {
>>       git {
>>         remote {
>>           url(data.git_url)
>>           credentials('xxxxx-xxxx')
>>         }
>>         createTag(false)
>>       }
>>      }
>>      else if(data.svn-url) {
>>         svn(data.svn-url) {
>>           it / locations / 'hudson.scm.SubversionSCM_-ModuleLocation' / 
>> credentialsId << 'xxxxx-xxxx'      
>>         }
>>      }
>>      else {
>>        // crash the build or something if none was found?
>>      }
>>
>> Cheers
>>
>> 2015-10-06 9:09 GMT+02:00 Nick Stolwijk <[email protected] 
>> <javascript:>>:
>>
>>> I'm trying to rebuild my Jenkins jobs through the Job DSL. I have found 
>>> a lot of documentation and examples, but none about conditional 
>>> configuration.
>>>
>>> I have the following job input:
>>>
>>> projects {
>>>   componentA {
>>>     svn-url = 'https://svn.localhost/componenta/trunk/'
>>>   }
>>>   componentB {
>>>     git-url = 'https://git.localhost/componentb.git'
>>>   }
>>> }
>>>
>>> Now I am trying to create jobs for this:
>>>
>>> def createUT(name, data) {
>>>   mavenJob("${name}_UT") {
>>>     description("Generated. Don't edit!")
>>>     scm { 
>>> //      git {
>>> //        remote {
>>> //          url(data.git_url)
>>> //          credentials('xxxxx-xxxx')
>>> //        }
>>> //        createTag(false)
>>> //      }
>>>         svn(data.svn-url) {
>>>           it / locations / 'hudson.scm.SubversionSCM_-ModuleLocation' / 
>>> credentialsId << 'xxxxx-xxxx'      
>>>         }
>>>     } 
>>>
>>> How can I create the git or the svn part, based on which variable is 
>>> declared?
>>>
>>> Hope someone can help.
>>>
>>> Nick Stolwijk
>>>
>>> ~~~ Try to leave this world a little better than you found it and, when 
>>> your turn comes to die, you can die happy in feeling that at any rate you 
>>> have not wasted your time but have done your best ~~~
>>>
>>> Lord Baden-Powell
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Jenkins Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected] <javascript:>.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/jenkinsci-users/CAA9S6i4Df6ENZ55Qmqx7aUYGmNFexFJ3opmeeJC72dxQpf5AFA%40mail.gmail.com
>>>  
>>> <https://groups.google.com/d/msgid/jenkinsci-users/CAA9S6i4Df6ENZ55Qmqx7aUYGmNFexFJ3opmeeJC72dxQpf5AFA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> -- 
>> Baptiste <Batmat> MATHUS - http://batmat.net
>> Sauvez un arbre,
>> Mangez un castor !
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Jenkins Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/CANWgJS7D%2BaczXQOSqJi44irrrXsR3JPoj7VQFnyHBJ2wMRq8tA%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/CANWgJS7D%2BaczXQOSqJi44irrrXsR3JPoj7VQFnyHBJ2wMRq8tA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/1acaacd0-493e-4a1d-8b13-ec86a9fe0061%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to