-
Patch
-
Resolution: Unresolved
-
Minor
-
None
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.
- relates to
-
JENKINS-54532 Document how to get parameters from a Run
- Open
- links to