Re: How to set Multibranch Pipeline Trigger interval via Jenkinsfile?

2017-07-27 Thread Yuri Govorushchenko
Thank you Stephen! After fixing typos it worked for me from Script Console:

for (f in 
Jenkins.instance.getAllItems(jenkins.branch.MultiBranchProject.class)) {
  if (f.parent instanceof jenkins.branch.OrganizationFolder) {
// managed by org folder, leave alone
continue;
  }
  // addTrigger will replace an existing one
  f.addTrigger(new 
com.cloudbees.hudson.plugins.folder.computed.PeriodicFolderTrigger("1d"));
}

Maybe in the future I'll be able to somehow incorporate this code into a 
JobDSL seed job to fully automate the definition of my multibranch job.

On Thursday, July 27, 2017 at 2:59:23 PM UTC+3, Stephen Connolly wrote:
>
> Cannot be done from a Jenkinsfile.
>
> You can do via the groovy console with something like
>
> for (var f in 
> Jenkins.instance.getAllItems(jenkins.branch.MultiBranchProject.class) {
>   if (f.parent instanceof jenkins.branch.OrganizationFolder) {
> // managed by org folder, leave alone
> continue;
>   }
>   // addTrigger will replace an existing one
>   f.addTrigger(new 
> com.cloudbees.hudson.plugins.folder.computedPeriodicFolderTrigger("1d"));
> }
>
> On 26 July 2017 at 20:03, Ramanathan Muthaiah  > wrote:
>
>> On Thursday, July 27, 2017 at 5:12:55 AM UTC+5:30, Yuri Govorushchenko 
>> wrote:
>>>
>>> Hello,
>>>
>>> I have a *Multibranch Pipeline* job and would like to programatically 
>>> set its property found in UI at *Scan Multibranch Pipeline Triggers -> 
>>> Periodically if not otherwise run -> Interval*. Ideally I'd like to do 
>>> it in a scripted *Jenkinsfile* used to define the job. Maybe it can be 
>>> somehow achieved via properties step? It seems to be a property of 
>>> CloudBees Folders Plugin 
>>>  but 
>>> I couldn't figure out how it can be modified without a UI.
>>>
>>
>> We are on the same boat . . . would be interested to know how this can be 
>> done; if you hit upon the solution, pls do share here.
>>
>> /Ram 
>>
>> -- 
>> 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 jenkinsci-use...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/ace70cd8-afa6-4966-a82c-e449cad3eeef%40googlegroups.com
>>  
>> 
>> .
>>
>> 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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/8cf5771d-a47a-461a-9668-dd66e3a327a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to set Multibranch Pipeline Trigger interval via Jenkinsfile?

2017-07-27 Thread Stephen Connolly
Cannot be done from a Jenkinsfile.

You can do via the groovy console with something like

for (var f in
Jenkins.instance.getAllItems(jenkins.branch.MultiBranchProject.class) {
  if (f.parent instanceof jenkins.branch.OrganizationFolder) {
// managed by org folder, leave alone
continue;
  }
  // addTrigger will replace an existing one
  f.addTrigger(new
com.cloudbees.hudson.plugins.folder.computedPeriodicFolderTrigger("1d"));
}

On 26 July 2017 at 20:03, Ramanathan Muthaiah  wrote:

> On Thursday, July 27, 2017 at 5:12:55 AM UTC+5:30, Yuri Govorushchenko
> wrote:
>>
>> Hello,
>>
>> I have a *Multibranch Pipeline* job and would like to programatically
>> set its property found in UI at *Scan Multibranch Pipeline Triggers ->
>> Periodically if not otherwise run -> Interval*. Ideally I'd like to do
>> it in a scripted *Jenkinsfile* used to define the job. Maybe it can be
>> somehow achieved via properties step? It seems to be a property of
>> CloudBees Folders Plugin
>>  but I
>> couldn't figure out how it can be modified without a UI.
>>
>
> We are on the same boat . . . would be interested to know how this can be
> done; if you hit upon the solution, pls do share here.
>
> /Ram
>
> --
> 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 jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/jenkinsci-users/ace70cd8-afa6-4966-a82c-e449cad3eeef%40googlegroups.
> com
> 
> .
>
> 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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CA%2BnPnMybN0tg-cDnmNmc0vcRCEpNGRMdAYj3U%2BOc2-gmYykwQA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to set Multibranch Pipeline Trigger interval via Jenkinsfile?

2017-07-26 Thread Ramanathan Muthaiah
On Thursday, July 27, 2017 at 5:12:55 AM UTC+5:30, Yuri Govorushchenko 
wrote:
>
> Hello,
>
> I have a *Multibranch Pipeline* job and would like to programatically set 
> its property found in UI at *Scan Multibranch Pipeline Triggers -> 
> Periodically if not otherwise run -> Interval*. Ideally I'd like to do it 
> in a scripted *Jenkinsfile* used to define the job. Maybe it can be 
> somehow achieved via properties step? It seems to be a property of 
> CloudBees Folders Plugin 
>  but I 
> couldn't figure out how it can be modified without a UI.
>

We are on the same boat . . . would be interested to know how this can be 
done; if you hit upon the solution, pls do share here.

/Ram 

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/ace70cd8-afa6-4966-a82c-e449cad3eeef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to set Multibranch Pipeline Trigger interval via Jenkinsfile?

2017-07-26 Thread Yuri Govorushchenko
Hello,

I have a *Multibranch Pipeline* job and would like to programatically set 
its property found in UI at *Scan Multibranch Pipeline Triggers -> 
Periodically if not otherwise run -> Interval*. Ideally I'd like to do it 
in a scripted *Jenkinsfile* used to define the job. Maybe it can be somehow 
achieved via properties step? It seems to be a property of 
CloudBees Folders Plugin 
 but I 
couldn't figure out how it can be modified without a UI.

Thanks.

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/d5304260-8e49-4ad1-b302-9b8b685973cc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Multibranch Pipeline trigger

2016-11-15 Thread Thomas Keller
Ok, I figured it out myself. Several issues on my side:

1) In order to get the upstream trigger set up, the dependent project needs 
to be run at least once, otherwise Jenkins obviously does not know anything 
about the trigger in first place.
2) Absolute project references of course need to start with a slash, i.e. 
/repos/barrepo/master
3) If relative project references are used, you need to remember that - by 
default - the trigger code resolves these references relative to the 
_parent_ project of the build. So if you have foorepo/master and 
barrepo/master, then you need to use "../barrepo/master", and not 
"../../barrepo/master" or anything alike.

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/521d11dd-1075-4965-834c-b077b70933a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Multibranch Pipeline trigger

2016-11-14 Thread Thomas Keller
Has anybody an idea?

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/9fee361d-574f-4eda-b117-9a7d21c82d6d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Multibranch Pipeline trigger

2016-11-10 Thread Thomas Keller
*bump*

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/32f57b52-f8cb-4d72-8bd4-840603e73f02%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Multibranch Pipeline trigger

2016-11-08 Thread Thomas Keller
Hey all!

I have multiple library projects that I build as multibranch pipelines. 
Naturally these library projects have dependencies and usually fetch these 
dependencies as a SNAPSHOT artifact from a previous build of the other 
library.

For the case where a such a dependency gets a change, I want to trigger a 
new build for all dependent library builds. These are my Jenkinsfile's for 
the two repos:


* in foo.git/Jenkinsfile


#!/usr/bin/env groovy

node {
stage('Test') {
checkout scm
sh "( sleep 5 && echo foo )"
}
}


* in bar.git/Jenkinsfile:

#!/usr/bin/env groovy

properties([ 
pipelineTriggers([ 
upstream( 
threshold: hudson.model.Result.SUCCESS, 
upstreamProjects: 'repos/foo/master' 
) 
]) 
]) 

node { 
stage('Test') { 
checkout scm 
sh "( sleep 5 && echo bar )" 
} 
}


Both Jenkins projects are saved underneath the directory "repos". Now I 
tried several versions how to reference "upstreamProjects", with relative 
paths "../../foo/master", "../foo/master" or simply "foo/master", or with 
the absolute path like above, but all without success: the "bar.git" 
project is just never triggered.


What am I doing wrong? Is this even a supported use case and if not, what 
are my alternatives given the above setup?


Thanks in advance,

Thomas.

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/6fc22699-13bc-4814-a49d-f8fef30fd206%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.