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

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      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

        Attachments

          Issue Links

            Activity

            cam Cameron I created issue -
            cam Cameron I made changes -
            Field Original Value New Value
            Description 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 :)
            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 :)
            cam Cameron I made changes -
            Description 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 :)
            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 :)
            cam Cameron I made changes -
            Summary Return list of environment variables of job in org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper Return map of environment variables of job in org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper
            cam Cameron I made changes -
            Description 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 :)
            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 :)
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 173241 ] JNJira + In-Review [ 185015 ]
            abayer Andrew Bayer made changes -
            Component/s pipeline-general [ 21692 ]
            abayer Andrew Bayer made changes -
            Component/s workflow-plugin [ 18820 ]
            jglick Jesse Glick made changes -
            Labels pipeline-build-step-plugin
            jglick Jesse Glick made changes -
            Component/s workflow-support-plugin [ 21719 ]
            Component/s pipeline [ 21692 ]
            jglick Jesse Glick made changes -
            Link This issue is duplicated by JENKINS-36213 [ JENKINS-36213 ]
            jglick Jesse Glick made changes -
            Assignee Jesse Glick [ jglick ]
            abayer Andrew Bayer made changes -
            Assignee Andrew Bayer [ abayer ]
            abayer Andrew Bayer made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            abayer Andrew Bayer made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]
            abayer Andrew Bayer made changes -
            Remote Link This issue links to "PR #45 (Web Link)" [ 17675 ]
            abayer Andrew Bayer made changes -
            Status In Review [ 10005 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            svanoort Sam Van Oort made changes -
            Status Resolved [ 5 ] Closed [ 6 ]

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: