Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running a parameterized job at a particular time in jenkins

I have a parameterized job which I want to schedule it to run at a particular time. Is there anyway I can choose my parameters and schedule it to run.

Thanks in advance

like image 890
Kishore Tamire Avatar asked May 29 '13 09:05

Kishore Tamire


People also ask

How do you use periodically with parameters in Jenkins?

Basically, with the 'Build periodically' option you can't schedule a Jenkins job with parameters. However, to schedule a job at different times that needs to use different environments, you have to use the parameterized-scheduler plugin or search for it in (Manage Jenkins -> Manage Plugins -> Parameterized Scheduler).

Can we schedule a job in Jenkins?

Add a Schedule to a Jenkins JobHead back to the job configuration and click the Build Triggers tab. Now, check the Build periodically box in the Build Triggers section. This will open the scheduling text area. Next, let's set the job to run every five minutes.


1 Answers

At least two ways to handle this,
but you have to know the desired values in advance:

  • Set the job's default values to what you need,
    then schedule it to run whenever you like.

  • Instead of scheduling the parameterized job,
    create another job that will trigger the
    parameterized job while passing the relevant
    values to the parameters
    (This also allows you to initiate the target-job
    with different sets of values).

EDIT:

This third method will allow you to update the values of the parameters as needed:

  • Set the job to read values of parameters from a configuration-file
    (via the EnvInject Plugin), then update the content of that configuration-file
    before running the job.

Note it will be bad-practice to modify this file before each run,
as there are better ways to automatically initiate Jenkins-jobs with parameters.

like image 122
Gonen Avatar answered Oct 09 '22 00:10

Gonen