Due to similar issues, I changed how I was doing it from a single
MultiBranch project.
I've now separate projects for each environment, also use
https://plugins.jenkins.io/cloudbees-folder to create prod and dev folders
which container the environment specific values.
Have a groovy script that creates all the MultiBranch projects, prod folder
and projects, dev folder and projects.

John


On Mon, 28 Nov 2022 at 06:04, Victor Sudakov <[email protected]> wrote:

> Dear Colleagues,
>
> Can you please suggest a way to use different credentials depending on the
> Git
> branch in a multi-branch pipeline? In other words, I would like to have
>
> pipeline {
>   environment {
>     CLIENT_ID = credentials('PROD_CLIENT_ID')
>   }
> ...
> }
>
> if the Git branch is "main" and
>
> pipeline {
>   environment {
>     CLIENT_ID = credentials('DEV_CLIENT_ID')
>   }
> ...
> }
>
> if the Git branch is "dev", or even "*".
>
> What would be the correct Groovy syntax to substitute "PROD_CLIENT_ID" or
> "DEV_CLIENT_ID" depending on the branch name?
>
> --
> Victor Sudakov
> Systems Administrator
> Streamline - Property Management Software
> Website: www.streamlinevrs.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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/Y4ROJK3SmJsTTxhz%40vrs6.4vrs.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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAH9u10%3DxZf5Z8Ucq95mHm81GWKTDofYa3UkaET%2BBc%2B5Pf%2BJgTQ%40mail.gmail.com.

Reply via email to