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

Expose build parameters in RunWrapper

    Details

    • Similar Issues:

      Description

      RunWrapper doesn't offer any way to access a run's build parameters.

      To address that, this patch adds new getBuildParameters() and getBuildParametersAsStrings() methods to RunWrapper.

      The former getBuildParameters method returns a parameter-type specific Object. It auto-wraps run parameters in a RunWrapper, returns string and boolean parameters as their base type, and otherwise returns whatever the parameter value is. Parameters marked sensitive are returned as their ParameterValue object with no unwrapping. This means scripts can't interact with all parameter types without extra approvals, but they can get the true parameter values and work with the common ones.

      The getBuildParametersAsStrings() method instead returns stringified forms of the parameters. These may be less useful for script logic, e.g. when a run name is returned instead of a RunWrapper. But it's much easier to use and more useful for diagnostic output and reporting to the user.

        Attachments

          Issue Links

            Activity

            Show
            ringerc Craig Ringer added a comment - PR https://github.com/jenkinsci/workflow-support-plugin/pull/81
            Hide
            abayer Andrew Bayer added a comment -

            I think you can get what you need with the params global variable that's already available - it's a map of all parameter defined for the job, with the key being the parameter name and the value being the parameter value.

            Show
            abayer Andrew Bayer added a comment - I think you can get what you need with the params global variable that's already available - it's a map of all parameter defined for the job, with the key being the parameter name and the value being the parameter value.
            Hide
            abayer Andrew Bayer added a comment -

            Oooooh, I get it - you're trying to get the parameters for a different build. Hrm.

            Show
            abayer Andrew Bayer added a comment - Oooooh, I get it - you're trying to get the parameters for a different build. Hrm.
            Hide
            ringerc Craig Ringer added a comment -

            Right. I replied by email, but there's apparently no email gateway to the notifications just a highly delayed bounce (sigh).

            I submitted a pull with a proposed implementation, any concerns with it?

            Show
            ringerc Craig Ringer added a comment - Right. I replied by email, but there's apparently no email gateway to the notifications just a highly delayed bounce (sigh). I submitted a pull with a proposed implementation, any concerns with it?

              People

              • Assignee:
                Unassigned
                Reporter:
                ringerc Craig Ringer
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: