Discussion:
Using extended choice parameter in Jenkins
VikS
2017-03-09 11:31:36 UTC
Permalink
-3 down vote favorite
<http://stackoverflow.com/questions/42686999/using-extended-choice-parameter-in-jenkins#>

I would like to create an Extended Choice Parameter option and for the
choices to be listed from a text file? Would it be possible and if yes, how
can i achieve that?

[image: Image]
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/96fc3e07-d7f7-40d6-bb5a-ce3c20541e89%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Ioannis Moutsatsos
2017-03-10 03:04:09 UTC
Permalink
Take a look at the Active Choices plugin
<https://wiki.jenkins-ci.org/display/JENKINS/Active+Choices+Plugin>
instead. A simple Groovy script can be used to read the text file and
return a list of the choices.
Post by VikS
-3 down vote favorite
<http://stackoverflow.com/questions/42686999/using-extended-choice-parameter-in-jenkins#>
I would like to create an Extended Choice Parameter option and for the
choices to be listed from a text file? Would it be possible and if yes, how
can i achieve that?
[image: Image]
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/da8fa3fe-dc93-4235-9e57-1485af5a6705%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
VikS
2017-03-10 05:40:41 UTC
Permalink
Thank you, I never scripted using Groovy and tried this *String
fileContents = new File("C:/temp/applicationlist.txt").text* which did not
work...
Post by Ioannis Moutsatsos
Take a look at the Active Choices plugin
<https://wiki.jenkins-ci.org/display/JENKINS/Active+Choices+Plugin>
instead. A simple Groovy script can be used to read the text file and
return a list of the choices.
Post by VikS
-3 down vote favorite
<http://stackoverflow.com/questions/42686999/using-extended-choice-parameter-in-jenkins#>
I would like to create an Extended Choice Parameter option and for the
choices to be listed from a text file? Would it be possible and if yes, how
can i achieve that?
[image: Image]
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/ae1008fe-2229-4c04-93bb-634ad9943011%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Ioannis Moutsatsos
2017-03-10 18:55:31 UTC
Permalink
Active Choices requires that the returned value from the script is a list
or a map. Each element then becomes a selectable option.
Assuming that each line of your text file contains an option you want to
display, try something along these lines for the Active Choices groovy
script:
def choices=[]
textFile= new File("C:/temp/applicationlist.txt")
textFile.eachLine{
choices.add(it)
}
return choices
Post by VikS
Thank you, I never scripted using Groovy and tried this *String
fileContents = new File("C:/temp/applicationlist.txt").text* which did
not work...
Take a look at the Active Choices plugin
<https://wiki.jenkins-ci.org/display/JENKINS/Active+Choices+Plugin>
instead. A simple Groovy script can be used to read the text file and
return a list of the choices.
-3 down vote favorite
<http://stackoverflow.com/questions/42686999/using-extended-choice-parameter-in-jenkins#>
I would like to create an Extended Choice Parameter option and for the
choices to be listed from a text file? Would it be possible and if yes, how
can i achieve that?
[image: Image]
--
You received this message because you are subscribed to a topic in the
Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/jenkinsci-users/tzvYEp76IVg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/ae1008fe-2229-4c04-93bb-634ad9943011%40googlegroups.com
<https://groups.google.com/d/msgid/jenkinsci-users/ae1008fe-2229-4c04-93bb-634ad9943011%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAOwNbFu8muzQcCb3o_J-W9NFzxqDm8Lo6FYKYRAm53sLpq9uhg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
VikS
2017-03-20 03:48:02 UTC
Permalink
Thank you, the script worked.. :)
Post by Ioannis Moutsatsos
Active Choices requires that the returned value from the script is a list
or a map. Each element then becomes a selectable option.
Assuming that each line of your text file contains an option you want to
display, try something along these lines for the Active Choices groovy
def choices=[]
textFile= new File("C:/temp/applicationlist.txt")
textFile.eachLine{
choices.add(it)
}
return choices
Post by VikS
Thank you, I never scripted using Groovy and tried this *String
fileContents = new File("C:/temp/applicationlist.txt").text* which did
not work...
Post by Ioannis Moutsatsos
Take a look at the Active Choices plugin
<https://wiki.jenkins-ci.org/display/JENKINS/Active+Choices+Plugin>
instead. A simple Groovy script can be used to read the text file and
return a list of the choices.
Post by VikS
-3 down vote favorite
<http://stackoverflow.com/questions/42686999/using-extended-choice-parameter-in-jenkins#>
I would like to create an Extended Choice Parameter option and for the
choices to be listed from a text file? Would it be possible and if yes, how
can i achieve that?
[image: Image]
--
You received this message because you are subscribed to a topic in the
Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/jenkinsci-users/tzvYEp76IVg/unsubscribe
.
To unsubscribe from this group and all its topics, send an email to
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/ae1008fe-2229-4c04-93bb-634ad9943011%40googlegroups.com
<https://groups.google.com/d/msgid/jenkinsci-users/ae1008fe-2229-4c04-93bb-634ad9943011%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/c33d173a-7511-48cc-a2ce-67c95c531beb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...