Hello, There's a bunch of examples there: https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+Script+Console (see the end of the page).
Cheers 2016-08-29 15:12 GMT+02:00 kumar naresh <[email protected]>: > > HI Colin, > > this groovy is updating/adding build perodic section in build triggers > section. > > can you please share the script to update poll scm section in build triger > section via groovy script. > > Regards, > Raju. > > > On Wednesday, October 29, 2014 at 2:27:47 PM UTC+5:30, Colin McIntyre > wrote: >> >> Old post, I know, but I just came across this issue so thought I'd add my >>> findings. https://issues.jenkins-ci.org/browse/JENKINS-14771 looks to >>> be the same issue, the reason for the NPE is that while you've added the >>> trigger to the job you haven't told the trigger about the job. To work >>> around it I used this code: >>> >> >> def job = hudson.model.Hudson.instance.getJob("My Job"); >> def spec = "0 0 1 * *"; >> hudson.triggers.TimerTrigger newCron = new hudson.triggers.TimerTrigger(s >> pec); >> newCron.start(job, true); >> job.addTrigger(newCron); >> job.save(); >> >> It's the call to TimerTrigger.start that sorted it for me. >> >> >> -- > 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/8e179ac5-a7ea-44ae-b0b8-3fef0fda9ec6%40googlegroups. > com > <https://groups.google.com/d/msgid/jenkinsci-users/8e179ac5-a7ea-44ae-b0b8-3fef0fda9ec6%40googlegroups.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/CANWgJS518n5unGQSkp_f6g4ASNNFQMzwyVHq58njB5PDvHFJGA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
