1

I have created a Jenkins job which have Choice Parameters, Active Choice Parameters, Active choice reactive params and Reactive reference params.

This job needs to be scheduled with parameters.

As the active choice params and reactive choice params are dynamically executed with groovy scripts.

How can I pass these parameters to schedule a job with cron present in Jenkins.

I'm using Parameterized Scheduler plugin for scheduling.

EDIT

Say I have a job which have

1 Active choice parameter PARAM_A

1 Active choice reactive parameter PARAM_B

2 active choice reactive reference parameters PARAM_C and PARAM_D.

I tried by hard coding active choice parameter in the cron like below

15 7 * * * % PARAM_A=somestring

But with the provided active choice value, the job is getting failed. Because the reactive reference parameters which were written in groovy script are not getting executed when i triggered with scheduler in jenkins.

In a jenkins schedule job using parameterized-scheduler, where if we give input

2
  • can you clarify more on this question?
    – Samit
    Feb 7, 2020 at 20:03
  • I have updated the question, please let me know, If you need anything mroe
    – Jman91
    Feb 12, 2020 at 6:34

1 Answer 1

1

Although I haven't tried using the Parameterized Scheduler in particular, I don't think you will be able to use this plugin to trigger a build with Active Choice parameters - most plugins don't support passing Active Choice parameters to builds. There is currently an open bug report on this issue.

As for a workaround - I have been able to successfully trigger builds with Active Choice parameters using the HTTP REST API /build endpoint (a bit counterintuitively, NOT /buildWithParameters). So for instance you could have a second job that runs on a schedule and does nothing but hit the API endpoint to trigger the job and pass parameters, or you could have a plain Unix cronjob that hits the endpoint, or something else along those lines.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.