I've just encountered the same when adding a TimerTrigger via Groovy. The reason for the NPE is that while the trigger has been added to the job, the trigger hasn't been told about the job. I worked around this using this code:

def job = hudson.model.Hudson.instance.getJob("My Job");
def spec = "0 0 1 * *";
hudson.triggers.TimerTrigger newCron = new hudson.triggers.TimerTrigger(spec);
newCron.start(job, true);
job.addTrigger(newCron);
job.save();

It's the call to TimerTrigger.start that sorted it for me. JENKINS-6508 was the original symptom for me, the trigger not firing. The NPE was the reason.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to