Reputation: 475
I have to build a jenkins job at a scheduled time from java:
node{
build job: 'NodeLabel',
parameters: [[$class: 'NodeParameterValue', name: 'labelName', labels: ["$Location"], nodeEligibility: [$class: 'AllNodeEligibility']],[$class: 'StringParameterValue', name: 'Name', value: name]]
}
I am able to build the above job using 'build periodically' or 'build periodically with parameters' plugin to run at a particular time.
MyQuestion
:
I have to build my jenkins job from java and I am able to pass other string parameter to my job from java but
Is it possible to pass schedule time
to a jenkins job which is using 'build periodically' plugin or 'build periodically with parameter' plugin
?
Upvotes: 0
Views: 617
Reputation: 2636
You can create a dummy project , that will get the delay parameter , will sleep the delay time and trigger the required pipeline.
Upvotes: 0
Reputation: 10192
You could pass a delay parameter http://jenkins/job/jobname/build?delay=7000, but to start at specific time, it would be easier to execute the rest call at the desired time from java - so create some kind of timer in java code.
Upvotes: 1