HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Schedule Jenkins Job with Active choice Reactive parameters and Reactive reference parameters

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
referenceactivereactivejenkinswithchoiceandparametersschedulejob

Problem

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

Solution

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.

Context

StackExchange DevOps Q#10732, answer score: 1

Revisions (0)

No revisions yet.