dan
dan

Reputation: 388

Is there a way to "delay" a job via the REST API

The instant messaging plugin is capable of taking an IM message like, "build XYZ in 10s" and setting the job to run in 10 seconds. It does this via a java API to schedule the job[0].

I'd like to know if there is some magic parameter I can pass on the REST API[1] that will allow me to "delay" a job in the same manner?

thanks.

[0] - https://github.com/jenkinsci/instant-messaging-plugin/blob/master/src/main/java/hudson/plugins/im/bot/BuildCommand.java#L54

[1] - https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API

Upvotes: 6

Views: 3885

Answers (1)

Daniel Beck
Daniel Beck

Reputation: 6513

GET the following URL:

http://jenkins/job/jobname/build?delay=4000sec

This example will result in a job being started after 4000 seconds.

Screenshot of build queue

This works with the buildWithParameters URL for parameterized jobs as well.

Upvotes: 11

Related Questions