Jenkins Pipeline Parameter Guide
While working on a Jenkins Pipeline project with several parameters; I found the official parameter documentation left something to be desired in terms of formatting, so I created this quick reference guide.
String
string (name: String, defaultValue: String, description: String)
string(name: '', defaultValue: '', description: '')
Text
text (name: String, defaultValue: String, description: String)
text(name: '', defaultValue: '', description: '')
Boolean
booleanParam (name: String, defaultValue: Boolean, description: String)
booleanParam(name: '', defaultValue: true, description: '')
Choice
choice (name: String, choices: String[], description: String)
choice(name: '', choices: ['true', 'false'], description: '')
choice(name: '', choices: 'true\nfalse', description: '')
It is recommended to use the array notation (i.e. the first option) rather than the second option. The second option is a bit of a hack and it looks messy due to the fact that you are dropping a literal \n (newline character) between the values ‘true’ and ‘false’.
Password
password (name: String, defaultValue: String, description: String)
password(name: '', defaultValue: '', description: '')