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/35f81b50-ac62-4f9c-8937-b8c600434a8e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to