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

Return map of environment variables of job in org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper

      With the Pipeline Plugin, I'd like a list of environment variables to be returned from the build result of a job (like you can already do with `duration` and `description`)

      For example,

      def e = build "test-env"
      echo "${e.environment.GIT_COMMIT}"
      echo "${e.environment.FOO}"
      

      I believe the fix is to add a whitelisted getEnvironment() method to the RunWrapper, similar to the one done in this merged PR here for JENKINS-36306

      The current fix is to access the environment variables is to access it via the rawBuild, however that needs to be explicitly whitelisted as RunWrapper.getRawBuild is blacklisted

      def e = build "test-env"
      echo "${e.rawBuild.environment.GIT_COMMIT}"
      

      Thanks

          [JENKINS-36528] Return map of environment variables of job in org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper

          Cameron I created issue -
          Cameron I made changes -
          Description Original: With the Pipeline Plugin, I'd like a list of environment variables to be returned from the build result of a job (like you can already with `duration` and `description` [already do](https://jenkins.io/doc/pipeline/steps/pipeline-build-step/#build-build-a-job))

          For example,
          ```
          def e = build "test-env"
          echo "${e.environment.GIT_COMMIT}"
          echo "${e.environment.FOO}"
          ```

          I believe the fix is to add a whitelisted getEnvironment() method to the RunWrapper, similar to the one done in this merged PR [here](https://github.com/jenkinsci/workflow-support-plugin/pull/6) for JENKINS-36306

          The current fix is to access the environment variables is to access it via the rawBuild, however that needs to be explicitly whitelisted as RunWrapper.getRawBuild is [blacklisted](https://github.com/jenkinsci/script-security-plugin/pull/69)
          ```
          def e = build "test-env"
          echo "${e.rawBuild.environment.GIT_COMMIT}"
          ```

          Thanks :)
          New: With the Pipeline Plugin, I'd like a list of environment variables to be returned from the build result of a job (like you can already with `duration` and `description` [already do](https://jenkins.io/doc/pipeline/steps/pipeline-build-step/#build-build-a-job))

          For example,
          {code}
          def e = build "test-env"
          echo "${e.environment.GIT_COMMIT}"
          echo "${e.environment.FOO}"
          {code}

          I believe the fix is to add a whitelisted getEnvironment() method to the RunWrapper, similar to the one done in this merged PR [here](https://github.com/jenkinsci/workflow-support-plugin/pull/6) for JENKINS-36306

          The current fix is to access the environment variables is to access it via the rawBuild, however that needs to be explicitly whitelisted as RunWrapper.getRawBuild is [blacklisted](https://github.com/jenkinsci/script-security-plugin/pull/69)
          {code}
          def e = build "test-env"
          echo "${e.rawBuild.environment.GIT_COMMIT}"
          {code}

          Thanks :)
          Cameron I made changes -
          Description Original: With the Pipeline Plugin, I'd like a list of environment variables to be returned from the build result of a job (like you can already with `duration` and `description` [already do](https://jenkins.io/doc/pipeline/steps/pipeline-build-step/#build-build-a-job))

          For example,
          {code}
          def e = build "test-env"
          echo "${e.environment.GIT_COMMIT}"
          echo "${e.environment.FOO}"
          {code}

          I believe the fix is to add a whitelisted getEnvironment() method to the RunWrapper, similar to the one done in this merged PR [here](https://github.com/jenkinsci/workflow-support-plugin/pull/6) for JENKINS-36306

          The current fix is to access the environment variables is to access it via the rawBuild, however that needs to be explicitly whitelisted as RunWrapper.getRawBuild is [blacklisted](https://github.com/jenkinsci/script-security-plugin/pull/69)
          {code}
          def e = build "test-env"
          echo "${e.rawBuild.environment.GIT_COMMIT}"
          {code}

          Thanks :)
          New: With the Pipeline Plugin, I'd like a list of environment variables to be returned from the build result of a job (like you can already with `duration` and `description` [already do|https://jenkins.io/doc/pipeline/steps/pipeline-build-step/#build-build-a-job])

          For example,
          {code}
          def e = build "test-env"
          echo "${e.environment.GIT_COMMIT}"
          echo "${e.environment.FOO}"
          {code}

          I believe the fix is to add a whitelisted getEnvironment() method to the RunWrapper, similar to the one done in this merged PR [here|https://github.com/jenkinsci/workflow-support-plugin/pull/6] for [JENKINS-36306]

          The current fix is to access the environment variables is to access it via the rawBuild, however that needs to be explicitly whitelisted as RunWrapper.getRawBuild is [blacklisted|https://github.com/jenkinsci/script-security-plugin/pull/69]
          {code}
          def e = build "test-env"
          echo "${e.rawBuild.environment.GIT_COMMIT}"
          {code}

          Thanks :)
          Cameron I made changes -
          Summary Original: Return list of environment variables of job in org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper New: Return map of environment variables of job in org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper
          Cameron I made changes -
          Description Original: With the Pipeline Plugin, I'd like a list of environment variables to be returned from the build result of a job (like you can already with `duration` and `description` [already do|https://jenkins.io/doc/pipeline/steps/pipeline-build-step/#build-build-a-job])

          For example,
          {code}
          def e = build "test-env"
          echo "${e.environment.GIT_COMMIT}"
          echo "${e.environment.FOO}"
          {code}

          I believe the fix is to add a whitelisted getEnvironment() method to the RunWrapper, similar to the one done in this merged PR [here|https://github.com/jenkinsci/workflow-support-plugin/pull/6] for [JENKINS-36306]

          The current fix is to access the environment variables is to access it via the rawBuild, however that needs to be explicitly whitelisted as RunWrapper.getRawBuild is [blacklisted|https://github.com/jenkinsci/script-security-plugin/pull/69]
          {code}
          def e = build "test-env"
          echo "${e.rawBuild.environment.GIT_COMMIT}"
          {code}

          Thanks :)
          New: With the Pipeline Plugin, I'd like a list of environment variables to be returned from the build result of a job (like you can [already do|https://jenkins.io/doc/pipeline/steps/pipeline-build-step/#build-build-a-job] with `duration` and `description`)

          For example,
          {code}
          def e = build "test-env"
          echo "${e.environment.GIT_COMMIT}"
          echo "${e.environment.FOO}"
          {code}

          I believe the fix is to add a whitelisted getEnvironment() method to the RunWrapper, similar to the one done in this merged PR [here|https://github.com/jenkinsci/workflow-support-plugin/pull/6] for [JENKINS-36306]

          The current fix is to access the environment variables is to access it via the rawBuild, however that needs to be explicitly whitelisted as RunWrapper.getRawBuild is [blacklisted|https://github.com/jenkinsci/script-security-plugin/pull/69]
          {code}
          def e = build "test-env"
          echo "${e.rawBuild.environment.GIT_COMMIT}"
          {code}

          Thanks :)
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 173241 ] New: JNJira + In-Review [ 185015 ]
          Andrew Bayer made changes -
          Component/s New: pipeline-general [ 21692 ]
          Andrew Bayer made changes -
          Component/s Original: workflow-plugin [ 18820 ]
          Jesse Glick made changes -
          Labels Original: pipeline-build-step-plugin
          Jesse Glick made changes -
          Component/s New: workflow-support-plugin [ 21719 ]
          Component/s Original: pipeline [ 21692 ]

            abayer Andrew Bayer
            cam Cameron I
            Votes:
            1 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: