Running a parameterized job at a particular time in jenkins Running a parameterized job at a particular time in jenkins jenkins jenkins

Running a parameterized job at a particular time in jenkins


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.


When build triggers are used to start a build, there's no way to pass parameters. Since the job is parameterized, the auto-start job will run with the default parameters.

If this is good enough , then you can simply set the schedule you want it to run via the 'Build Triggers' section of the job config page, you would then choose the 'Build periodically' checkbox and add the appropriate values (using syntax of cron). Let the default params take effect.

However, you could POST to jenkins as a trigger, and pass the exact values you wish. You then woudl have to use CRON directly for this with a shell script likely, so you can set the param values.

For example,

http://example.com/jenkins/job/this_job/buildWithParameters?PARAMETER=Value


Building on Gonen's answer a little bit, you can use the Build Flow Plugin to make this a bit easier on yourself. After installing, create a new job and set the type to "Build Flow". Configure this job to run at the desired, scheduled time. In the "Define build flow using flow DSL" section for this job, specify the job(s) you want it to build:

build( "Job You Want Built", param1:"whatever", Param2:"whatever")

You can specify more jobs to be built by adding more lines, or repeat the same line and change the parameters to build the job more than once with different params.

Once you're done, your Build Flow job will run at the scheduled time and kick off the desired jobs with the specified parameters.