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

Expose build parameters in RunWrapper

XMLWordPrintable

      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.

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

              Created:
              Updated: