Thanks for the reply, but I need to set the variable outside the pipeline 
script similar to the Environment Injector plugin. Is there a way to do 
that?

On Tuesday, 13 June 2017 13:36:07 UTC+1, Kevin Burnett wrote:
>
> here's an example Jenkinsfile that sets an environment variable (REPO_URL) 
> that applies to all stages. you can also use the withEnv step to set an 
> environment variable for a certain block.
>
> pipeline {
>   agent { label 'docker' }
>   environment {
>     REPO_URL = 'www.my.repo'
>   }
>   stages {
>     stage('build') {
>       steps {
>         sh 'env | grep REPO_URL'
>       }
>     }
>   }
> }
>
> Jenkinsfiles apply to all branches in a repo, so that part is handled 
> implicitly.
>
> Hope this helps,
> KB
>
>
> On Tuesday, June 13, 2017 at 3:53:33 AM UTC-4, Mark Allison wrote:
>>
>> I have a Jenkins multibranch pipeline project and I want to set an 
>> environment variable for all branches. Is this possible? I could only see a 
>> way to do it with the environment injector plugin at the branch level. I 
>> want to be able to do this at the project level because I want new feature 
>> branches to automatically inherit some environment variables.
>>
>

-- 
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/67fe426e-5c0d-4019-8972-d9ac24167fce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to