@ExportedBean public class ParametersAction extends Object implements RunAction2, Iterable<ParameterValue>, Queue.QueueAction, EnvironmentContributingAction, LabelAssignmentAction
This object is associated with the build record so that we remember what parameters were used for what build. It is also attached to the queue item to remember parameter that were specified when scheduling.
| Modifier and Type | Field and Description |
|---|---|
static String |
KEEP_UNDEFINED_PARAMETERS_SYSTEM_PROPERTY_NAME |
static String |
SAFE_PARAMETERS_SYSTEM_PROPERTY_NAME |
| Constructor and Description |
|---|
ParametersAction(List<ParameterValue> parameters) |
ParametersAction(List<ParameterValue> parameters,
Collection<String> additionalSafeParameters)
Constructs a new action with additional safe parameters.
|
ParametersAction(ParameterValue... parameters) |
| Modifier and Type | Method and Description |
|---|---|
void |
buildEnvVars(AbstractBuild<?,?> build,
EnvVars env)
Called by
AbstractBuild to allow plugins to contribute environment variables. |
void |
createBuildWrappers(AbstractBuild<?,?> build,
Collection<? super BuildWrapper> result) |
ParametersAction |
createUpdated(Collection<? extends ParameterValue> overrides)
Creates a new
ParametersAction that contains all the parameters in this action
with the overrides / new values given as parameters. |
VariableResolver<String> |
createVariableResolver(AbstractBuild<?,?> build)
Creates an
VariableResolver that aggregates all the parameters. |
List<ParameterValue> |
getAllParameters()
Returns all parameters.
|
Label |
getAssignedLabel(SubTask task)
Reassigns where the task gets run.
|
String |
getDisplayName()
Gets the string to be displayed.
|
String |
getIconFileName()
Gets the file name of the icon.
|
ParameterValue |
getParameter(String name) |
List<ParameterValue> |
getParameters() |
String |
getUrlName()
Gets the URL path name.
|
Iterator<ParameterValue> |
iterator() |
ParametersAction |
merge(ParametersAction overrides) |
void |
onAttached(Run<?,?> r)
Called when this action is added to a build.
|
void |
onLoad(Run<?,?> r)
Called after a build is loaded to which this action was previously attached.
|
boolean |
shouldSchedule(List<Action> actions)
Allow an other build of the same project to be scheduled, if it has other parameters.
|
String |
substitute(AbstractBuild<?,?> build,
String text)
Performs a variable substitution to the given text and return it.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliterator@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) public static final String KEEP_UNDEFINED_PARAMETERS_SYSTEM_PROPERTY_NAME
@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) public static final String SAFE_PARAMETERS_SYSTEM_PROPERTY_NAME
public ParametersAction(List<ParameterValue> parameters)
public ParametersAction(List<ParameterValue> parameters, Collection<String> additionalSafeParameters)
SAFE_PARAMETERS_SYSTEM_PROPERTY_NAME.
See SECURITY-170parameters - the parametersadditionalSafeParameters - additional safe parameterspublic ParametersAction(ParameterValue... parameters)
public void createBuildWrappers(AbstractBuild<?,?> build, Collection<? super BuildWrapper> result)
public void buildEnvVars(AbstractBuild<?,?> build, EnvVars env)
EnvironmentContributingActionAbstractBuild to allow plugins to contribute environment variables.buildEnvVars in interface EnvironmentContributingActionbuild - The calling build. Never null.env - Environment variables should be added to this map.public String substitute(AbstractBuild<?,?> build, String text)
public VariableResolver<String> createVariableResolver(AbstractBuild<?,?> build)
VariableResolver that aggregates all the parameters.
If you are a BuildStep, most likely you should call AbstractBuild.getBuildVariableResolver().
public Iterator<ParameterValue> iterator()
iterator in interface Iterable<ParameterValue>@Exported(visibility=2) public List<ParameterValue> getParameters()
public ParameterValue getParameter(String name)
public Label getAssignedLabel(SubTask task)
LabelAssignmentActiongetAssignedLabel in interface LabelAssignmentActiontask - Never null.LabelAssignmentActions take control, eventually to SubTask#getAssignedLabel().
If non-null value is returned, that label will be authoritative.public String getDisplayName()
ActiongetDisplayName in interface ActiongetDisplayName in interface ModelObjectpublic String getIconFileName()
ActiongetIconFileName in interface ActionIf an absolute file name that starts from '/' is returned (like "/plugin/foo/abc.gif'), then it will be interpreted as a path from the context root of Jenkins. This is useful to pick up image files from a plugin.
Finally, return null to hide it from the task list. This is normally not very useful, but this can be used for actions that only contribute floatBox.jelly and no task list item. The other case where this is useful is to avoid showing links that require a privilege when the user is anonymous.
Functions.isAnonymous(),
Functions.getIconFilePath(Action)public String getUrlName()
ActionFor example, if this method returns "xyz", and if the parent object (that this action is associated with) is bound to /foo/bar/zot, then this action object will be exposed to /foo/bar/zot/xyz.
This method should return a string that's unique among other Actions.
The returned string can be an absolute URL, like "http://www.sun.com/", which is useful for directly connecting to external systems.
If the returned string starts with '/', like '/foo', then it's assumed to be relative to the context path of the Jenkins webapp.
getUrlName in interface ActionAction.getIconFileName().Functions.getActionUrl(String, Action)public boolean shouldSchedule(List<Action> actions)
shouldSchedule in interface Queue.QueueAction@Nonnull public ParametersAction createUpdated(Collection<? extends ParameterValue> overrides)
ParametersAction that contains all the parameters in this action
with the overrides / new values given as parameters.ParametersAction. The result may contain null ParameterValues@Nonnull public ParametersAction merge(@CheckForNull ParametersAction overrides)
public void onAttached(Run<?,?> r)
RunAction2onAttached in interface RunAction2public void onLoad(Run<?,?> r)
RunAction2onLoad in interface RunAction2public List<ParameterValue> getAllParameters()
ParametersDefinitionProperty in the job, so any external
caller could inject any parameter (using any key) here. Treat it as untrusted data.Copyright © 2019. All rights reserved.