Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conditional Parameter based on User input in Jenkins

I have a requirement to call a parameter based on user input for another parameter. In short,

I have a parameter for build_type with choice values Daily, Release and Snapshot. Only whenever user selects Snapshot option for build_type, it should prompt user to enter snapshot name.

Do we have any plugin for this ?

Thanks, Ras.

like image 519
Ras Avatar asked Mar 06 '23 02:03

Ras


1 Answers

Give this a try https://wiki.jenkins.io/pages/viewpage.action?pageId=74875956
Its straight forward you can also try this https://wiki.jenkins.io/display/JENKINS/Extended+Choice+Parameter+plugin

EDITED
It does work, you just have to do a bit of groovy scripting :)

First you need to select Active Choice Parameter enter image description here

Then select Active Choice Reactive reference Parameter

enter image description here

Groovy script

   if(States.equals("Snapshot")){
inputBox="<input name='Snapshot' type='text' >"
}

TA-DA enter image description here

I'll leave the beautification/formatting to you :)

like image 128
rohit thomas Avatar answered Mar 16 '23 18:03

rohit thomas