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.

          [JENKINS-54535] Expose build parameters in RunWrapper

          Craig Ringer added a comment -

          Craig Ringer added a comment - PR https://github.com/jenkinsci/workflow-support-plugin/pull/81

          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.

          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.

          Andrew Bayer added a comment -

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

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

          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?

          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?

          Matt Dee added a comment -

          Is there any workaround to get the parameters from this object? 

          Matt Dee added a comment - Is there any workaround to get the parameters from this object? 

            Unassigned Unassigned
            ringerc Craig Ringer
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: