Quantcast

Using extended choice parameter in Jenkins

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Using extended choice parameter in Jenkins

VikS

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

--
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 [hidden email].
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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using extended choice parameter in Jenkins

Ioannis Moutsatsos-2
Take a look at the Active Choices plugin instead. A simple Groovy script can be used to read the text file and return a list of the choices.

On Thursday, March 9, 2017 at 6:31:36 AM UTC-5, VikS wrote:
-3 down vote <a title="Click to mark as favorite question (click again to undo)" href="http://stackoverflow.com/questions/42686999/using-extended-choice-parameter-in-jenkins#" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fstackoverflow.com%2Fquestions%2F42686999%2Fusing-extended-choice-parameter-in-jenkins%23\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFg3Ebf8wP0OPvuLzwLory5YB8Y3A&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fstackoverflow.com%2Fquestions%2F42686999%2Fusing-extended-choice-parameter-in-jenkins%23\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFg3Ebf8wP0OPvuLzwLory5YB8Y3A&#39;;return true;">favorite

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

--
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 [hidden email].
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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using extended choice parameter in Jenkins

VikS
Thank you, I never scripted using Groovy and tried this String fileContents = new File("C:/temp/applicationlist.txt").text which did not work...

On Friday, March 10, 2017 at 11:04:10 AM UTC+8, Ioannis Moutsatsos wrote:
Take a look at the <a href="https://wiki.jenkins-ci.org/display/JENKINS/Active+Choices+Plugin" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwiki.jenkins-ci.org%2Fdisplay%2FJENKINS%2FActive%2BChoices%2BPlugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF30gD_VyE39ZX7DqIdjOA3sdYhKg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwiki.jenkins-ci.org%2Fdisplay%2FJENKINS%2FActive%2BChoices%2BPlugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF30gD_VyE39ZX7DqIdjOA3sdYhKg&#39;;return true;">Active Choices plugin instead. A simple Groovy script can be used to read the text file and return a list of the choices.

On Thursday, March 9, 2017 at 6:31:36 AM UTC-5, VikS wrote:
-3 down vote <a title="Click to mark as favorite question (click again to undo)" href="http://stackoverflow.com/questions/42686999/using-extended-choice-parameter-in-jenkins#" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fstackoverflow.com%2Fquestions%2F42686999%2Fusing-extended-choice-parameter-in-jenkins%23\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFg3Ebf8wP0OPvuLzwLory5YB8Y3A&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fstackoverflow.com%2Fquestions%2F42686999%2Fusing-extended-choice-parameter-in-jenkins%23\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFg3Ebf8wP0OPvuLzwLory5YB8Y3A&#39;;return true;">favorite

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

--
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 [hidden email].
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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using extended choice parameter in Jenkins

Ioannis Moutsatsos-2
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

On Fri, Mar 10, 2017 at 12:40 AM VikS <[hidden email]> wrote:
Thank you, I never scripted using Groovy and tried this String fileContents = new File("C:/temp/applicationlist.txt").text which did not work...


On Friday, March 10, 2017 at 11:04:10 AM UTC+8, Ioannis Moutsatsos wrote:
Take a look at the Active Choices plugin instead. A simple Groovy script can be used to read the text file and return a list of the choices.

On Thursday, March 9, 2017 at 6:31:36 AM UTC-5, VikS wrote:

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

--
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 [hidden email].
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.

--
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 [hidden email].
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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using extended choice parameter in Jenkins

VikS
Thank you, the script worked.. :)

On Saturday, March 11, 2017 at 2:55:52 AM UTC+8, Ioannis Moutsatsos wrote:
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

On Fri, Mar 10, 2017 at 12:40 AM VikS <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="WiL1kcx3BAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">vsur...@...> wrote:
Thank you, I never scripted using Groovy and tried this String fileContents = new File("C:/temp/applicationlist.txt").text which did not work...


On Friday, March 10, 2017 at 11:04:10 AM UTC+8, Ioannis Moutsatsos wrote:
Take a look at the <a href="https://wiki.jenkins-ci.org/display/JENKINS/Active+Choices+Plugin" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwiki.jenkins-ci.org%2Fdisplay%2FJENKINS%2FActive%2BChoices%2BPlugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF30gD_VyE39ZX7DqIdjOA3sdYhKg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwiki.jenkins-ci.org%2Fdisplay%2FJENKINS%2FActive%2BChoices%2BPlugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF30gD_VyE39ZX7DqIdjOA3sdYhKg&#39;;return true;">Active Choices plugin instead. A simple Groovy script can be used to read the text file and return a list of the choices.

On Thursday, March 9, 2017 at 6:31:36 AM UTC-5, VikS wrote:
-3 down vote <a title="Click to mark as favorite question (click again to undo)" href="http://stackoverflow.com/questions/42686999/using-extended-choice-parameter-in-jenkins#" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fstackoverflow.com%2Fquestions%2F42686999%2Fusing-extended-choice-parameter-in-jenkins%23\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFg3Ebf8wP0OPvuLzwLory5YB8Y3A&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fstackoverflow.com%2Fquestions%2F42686999%2Fusing-extended-choice-parameter-in-jenkins%23\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFg3Ebf8wP0OPvuLzwLory5YB8Y3A&#39;;return true;">favorite

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

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit <a href="https://groups.google.com/d/topic/jenkinsci-users/tzvYEp76IVg/unsubscribe" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/topic/jenkinsci-users/tzvYEp76IVg/unsubscribe&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/topic/jenkinsci-users/tzvYEp76IVg/unsubscribe&#39;;return true;">https://groups.google.com/d/topic/jenkinsci-users/tzvYEp76IVg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="WiL1kcx3BAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/ae1008fe-2229-4c04-93bb-634ad9943011%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/ae1008fe-2229-4c04-93bb-634ad9943011%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/ae1008fe-2229-4c04-93bb-634ad9943011%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-users/ae1008fe-2229-4c04-93bb-634ad9943011%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 [hidden email].
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...