Add a CronScheduler to

Hi,
I am trying to add a CronScheduler to a SBuildType, while modifying the projects with a plugin.
How can this be done ? I didn't find any method to allow this.

Thanks

1 comment
Comment actions Permalink

This is possible but not with Open API.

Create jetbrains.buildServer.buildTriggers.scheduler.CronExpression from the cron expression string, then create CronScheduler:
jetbrains.buildServer.buildTriggers.scheduler.SchedulingPolicy policy = new jetbrains.buildServer.buildTriggers.scheduler.CronScheduler(CronExpression);

Then create build trigger:
BuildTrigger trigger = new BuildScheduler(SBuildServer, SystemTimeService.getInstance(), policy);

This trigger can then be added to BuildType::addBuildTrigger()
Do not forget to call persist: BuildType::getProject().persist() to persist configuration on disk.

0

Please sign in to leave a comment.