Could you do something like this?

ENVS="dev1|dev2|dev"


pipeline {
  parameters {
    choice(choices: "${env.ENVS.replace('|', '\n')}", description: 'What
Environment?', name: 'env')
  }
}

On Tue, Aug 29, 2017 at 9:07 AM Mike Zupan <[email protected]> wrote:

> I have a use case where we need to list environments to run a pipeline
> over and we have multiple jenkins servers that handle different
> environments.
>
> jenkins1 handles dev1 dev2 dev3
> jenkins2 handles prod1 prod2 prod3
>
> I want to be able to setup a pipeline that sources different envs and
> shows them as a choice field.
>
> Try one was setting a global env var in the jenkins config like
>
> ENVS="dev1\ndev2\ndev3"
>
> when I did
>
> pipeline {
>     parameters {
>       choice(choices: "${env.ENVS}", description: 'What Environment?',
> name: 'env')
>     }
> }
>
> It removed the \ so it shows it as a single choice as dev1ndev2ndev3
>
> I'd also be open to having it read a file outside the workspace where
> ansible can put like /etc/env_list and the pipeline can read that file in
> but I wasn't haven't any luck with that.
>
> I'm open to trying anything to make it work!
>
> Thanks!
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/8275681d-af79-41bb-b852-f0008e3fc0af%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/8275681d-af79-41bb-b852-f0008e3fc0af%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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVe36WiABk0hSxNwrWgc%2BH486ZRWX%2BYoLztb7OgOFV8d0Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to