Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-46814

Overrides to global env vars not honored on pipeline job

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • envinject-plugin, pipeline
    • None
    • Centos 7, Jenkins 2.60.2, Environment Injector Plugin 2.1.3, Pipeline 2.5

      The env injector plugin is available on a Pipeline job. If one attempts to override an env var defined in Jenkins Config, the new value is not made available to the DSL for the pipeline.

      In Jenkins config set env var FOO=BAR

      In Pipeline job env injector check "Prepare an environment for the run" and then in "Properties Content" add "FOO=BAZ"

       

      For pipeline script

       

      node() {
         stage('vars') {
             sh 'env'
        }
      }

       

      Run the job and console output will show env var FOO=BAR

       

      One is able to override env var using Freestyle project.

       

      If env injector plugin is NOT the proper way to override global env vars, please advise on what is the correct way to accomplish this in a pipeline.

       

            Unassigned Unassigned
            peternhale Pete Hale
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: