Created
February 2, 2017 17:58
-
-
Save visitbethel/e4f7e8be66c67b69005bf45a01902c36 to your computer and use it in GitHub Desktop.
Jenkins Pipeline Input Dropdown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Change `url` value to your own | |
def inputParams=new URL('http://maven.com/sefs/sefs-scm.txt').text | |
// Change `message` value to the message you want to display | |
// Change `description` value to the description you want | |
def selectedProperty = input( id: 'userInput', message: 'Choose properties file', | |
parameters: [ [ | |
$class: 'ChoiceParameterDefinition', | |
choices: inputParams, | |
description: 'Properties', | |
name: 'prop'] ]) | |
println "Property: $selectedProperty" | |
// Change `job` value to your downstream job name | |
// Change `name` value to the name you gave the string parameter in your downstream job | |
====> JAVA | |
https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/ChoiceParameterDefinition.java#L20 | |
@DataBoundConstructor | |
public ChoiceParameterDefinition(String name, String choices, String description) { | |
super(name, description); | |
this.choices = Arrays.asList(choices.split(CHOICES_DELIMITER)); | |
defaultValue = null; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The input string must be one string with CRLF's to get things split out
"debug\nrelease\ndev",