Choice Parameter from Shared LIbrary Step

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Choice Parameter from Shared LIbrary Step

Ven H
Is it possible to populate a Choice parameter values (choices) with values retrieved from a Shared Library Step? Please help.

Regards,
Venkatesh

--
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/CAPp28erSn6zVWDG3--wTLgWT%2BGqVPSBWWwfvrNicqH0B3pZYdQ%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Choice Parameter from Shared LIbrary Step

Senthil Nathan
Yes. In below example the choice_list can come from a shared pipeline library.

Eg)
Jenkinsfile:
========
choice_list=["choice1", "choice2", choice3"]
properties([                                                                                                                                                  
            parameters([                                                                                                                                      
              choice(name: 'mychoiceparam', choices:choice_list, description: 'my choices')])
])    

On Fri, Dec 18, 2020 at 10:53 AM Ven H <[hidden email]> wrote:
Is it possible to populate a Choice parameter values (choices) with values retrieved from a Shared Library Step? Please help.

Regards,
Venkatesh

--
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/CAPp28erSn6zVWDG3--wTLgWT%2BGqVPSBWWwfvrNicqH0B3pZYdQ%40mail.gmail.com.

--
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/CAJgiyW_9K9XjVL%2BoJPDhAGsN6eFGGY4BDcg-LECrYEZM%3DCWhkw%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Choice Parameter from Shared LIbrary Step

Ven H
Thanks a lot, Senthil. Can it be a Shared Library Step or a Class method only?. It will be great, if you can please help with some examples.

Regards,
Venkatesh


On Sat, Dec 19, 2020 at 12:48 AM Senthil Nathan <[hidden email]> wrote:
Yes. In below example the choice_list can come from a shared pipeline library.

Eg)
Jenkinsfile:
========
choice_list=["choice1", "choice2", choice3"]
properties([                                                                                                                                                  
            parameters([                                                                                                                                      
              choice(name: 'mychoiceparam', choices:choice_list, description: 'my choices')])
])    

On Fri, Dec 18, 2020 at 10:53 AM Ven H <[hidden email]> wrote:
Is it possible to populate a Choice parameter values (choices) with values retrieved from a Shared Library Step? Please help.

Regards,
Venkatesh

--
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/CAPp28erSn6zVWDG3--wTLgWT%2BGqVPSBWWwfvrNicqH0B3pZYdQ%40mail.gmail.com.

--
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/CAJgiyW_9K9XjVL%2BoJPDhAGsN6eFGGY4BDcg-LECrYEZM%3DCWhkw%40mail.gmail.com.

--
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/CAPp28epAOCv%3DaB2GR-xBpOOWpF%2B5X0zjp20zN5rGiqsaY_Q1_Q%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Choice Parameter from Shared LIbrary Step

Senthil Nathan
You have to create a list from the return value of the library step. 

I don't know what library step you are using so cannot provide specific example.

On Sat, Dec 19, 2020, 12:59 AM Ven H <[hidden email]> wrote:
Thanks a lot, Senthil. Can it be a Shared Library Step or a Class method only?. It will be great, if you can please help with some examples.

Regards,
Venkatesh


On Sat, Dec 19, 2020 at 12:48 AM Senthil Nathan <[hidden email]> wrote:
Yes. In below example the choice_list can come from a shared pipeline library.

Eg)
Jenkinsfile:
========
choice_list=["choice1", "choice2", choice3"]
properties([                                                                                                                                                  
            parameters([                                                                                                                                      
              choice(name: 'mychoiceparam', choices:choice_list, description: 'my choices')])
])    

On Fri, Dec 18, 2020 at 10:53 AM Ven H <[hidden email]> wrote:
Is it possible to populate a Choice parameter values (choices) with values retrieved from a Shared Library Step? Please help.

Regards,
Venkatesh

--
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/CAPp28erSn6zVWDG3--wTLgWT%2BGqVPSBWWwfvrNicqH0B3pZYdQ%40mail.gmail.com.

--
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/CAJgiyW_9K9XjVL%2BoJPDhAGsN6eFGGY4BDcg-LECrYEZM%3DCWhkw%40mail.gmail.com.

--
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/CAPp28epAOCv%3DaB2GR-xBpOOWpF%2B5X0zjp20zN5rGiqsaY_Q1_Q%40mail.gmail.com.

--
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/CAJgiyW9zXM51G3mhCgUt3xx3N8z%3Dw0J70ngmRQqO9RmAE%2BZmSQ%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Choice Parameter from Shared LIbrary Step

Ven H
Let's say I have the following use case. I have 3 choice parameters, namely, Country, State, City. I have shared library steps to GetCountries, then GetStates with country as argument and then GetCities with country and state as arguments. In my pipeline job, I will have 3 Choice parameters, one each for Country, State and City, with a cascading functionality, which is, when I select a Country, the states will be populated accordingly and upon selection of a state, cities will be populated accordingly. 

choice(name: 'Country', description: 'Select Country', choices:'GetCountriesFromSharedLibStep')
choice(name: 'State', description: 'Select State', choices:'GetStatesFromSharedLibStep('${params.Country}')  
choice(name: 'City', description: 'Select City', choices:'GetCitiesFromSharedLibStep('${params.Country}', '${params.State}' )   

Has anyone had this kind of a requirement. If so, how to achieve this? Please help with some examples / code.

Regards,
Venkatesh


On Sat, Dec 19, 2020 at 1:15 AM Senthil Nathan <[hidden email]> wrote:
You have to create a list from the return value of the library step. 

I don't know what library step you are using so cannot provide specific example.

On Sat, Dec 19, 2020, 12:59 AM Ven H <[hidden email]> wrote:
Thanks a lot, Senthil. Can it be a Shared Library Step or a Class method only?. It will be great, if you can please help with some examples.

Regards,
Venkatesh


On Sat, Dec 19, 2020 at 12:48 AM Senthil Nathan <[hidden email]> wrote:
Yes. In below example the choice_list can come from a shared pipeline library.

Eg)
Jenkinsfile:
========
choice_list=["choice1", "choice2", choice3"]
properties([                                                                                                                                                  
            parameters([                                                                                                                                      
              choice(name: 'mychoiceparam', choices:choice_list, description: 'my choices')])
])    

On Fri, Dec 18, 2020 at 10:53 AM Ven H <[hidden email]> wrote:
Is it possible to populate a Choice parameter values (choices) with values retrieved from a Shared Library Step? Please help.

Regards,
Venkatesh

--
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/CAPp28erSn6zVWDG3--wTLgWT%2BGqVPSBWWwfvrNicqH0B3pZYdQ%40mail.gmail.com.

--
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/CAJgiyW_9K9XjVL%2BoJPDhAGsN6eFGGY4BDcg-LECrYEZM%3DCWhkw%40mail.gmail.com.

--
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/CAPp28epAOCv%3DaB2GR-xBpOOWpF%2B5X0zjp20zN5rGiqsaY_Q1_Q%40mail.gmail.com.

--
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/CAJgiyW9zXM51G3mhCgUt3xx3N8z%3Dw0J70ngmRQqO9RmAE%2BZmSQ%40mail.gmail.com.

--
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/CAPp28eoZYfXiWX9JOLKoTMpJOFtL9ZZSee8Jaen11Cx6CxtriQ%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Choice Parameter from Shared LIbrary Step

Ven H
Can anyone please help?


Regards,
Venkatesh


On Sat, Dec 19, 2020 at 11:13 AM Ven H <[hidden email]> wrote:
Let's say I have the following use case. I have 3 choice parameters, namely, Country, State, City. I have shared library steps to GetCountries, then GetStates with country as argument and then GetCities with country and state as arguments. In my pipeline job, I will have 3 Choice parameters, one each for Country, State and City, with a cascading functionality, which is, when I select a Country, the states will be populated accordingly and upon selection of a state, cities will be populated accordingly. 

choice(name: 'Country', description: 'Select Country', choices:'GetCountriesFromSharedLibStep')
choice(name: 'State', description: 'Select State', choices:'GetStatesFromSharedLibStep('${params.Country}')  
choice(name: 'City', description: 'Select City', choices:'GetCitiesFromSharedLibStep('${params.Country}', '${params.State}' )   

Has anyone had this kind of a requirement. If so, how to achieve this? Please help with some examples / code.

Regards,
Venkatesh


On Sat, Dec 19, 2020 at 1:15 AM Senthil Nathan <[hidden email]> wrote:
You have to create a list from the return value of the library step. 

I don't know what library step you are using so cannot provide specific example.

On Sat, Dec 19, 2020, 12:59 AM Ven H <[hidden email]> wrote:
Thanks a lot, Senthil. Can it be a Shared Library Step or a Class method only?. It will be great, if you can please help with some examples.

Regards,
Venkatesh


On Sat, Dec 19, 2020 at 12:48 AM Senthil Nathan <[hidden email]> wrote:
Yes. In below example the choice_list can come from a shared pipeline library.

Eg)
Jenkinsfile:
========
choice_list=["choice1", "choice2", choice3"]
properties([                                                                                                                                                  
            parameters([                                                                                                                                      
              choice(name: 'mychoiceparam', choices:choice_list, description: 'my choices')])
])    

On Fri, Dec 18, 2020 at 10:53 AM Ven H <[hidden email]> wrote:
Is it possible to populate a Choice parameter values (choices) with values retrieved from a Shared Library Step? Please help.

Regards,
Venkatesh

--
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/CAPp28erSn6zVWDG3--wTLgWT%2BGqVPSBWWwfvrNicqH0B3pZYdQ%40mail.gmail.com.

--
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/CAJgiyW_9K9XjVL%2BoJPDhAGsN6eFGGY4BDcg-LECrYEZM%3DCWhkw%40mail.gmail.com.

--
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/CAPp28epAOCv%3DaB2GR-xBpOOWpF%2B5X0zjp20zN5rGiqsaY_Q1_Q%40mail.gmail.com.

--
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/CAJgiyW9zXM51G3mhCgUt3xx3N8z%3Dw0J70ngmRQqO9RmAE%2BZmSQ%40mail.gmail.com.

--
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/CAPp28eoVFR8eGYoNjniLGx0ZmqWtt9q-XiBkyDgU1MPPsYs%2Bnw%40mail.gmail.com.