Context represents a model of the job runtime. This class allows user to access procedure parameters, config values and define a step result.
Type | Name and description |
---|---|
java.lang.String |
configName Name of the configuration specified as one of the parameter values. |
java.lang.String |
currentProjectName Full name of the project we are running in |
Config |
currentStepConfigValues Values from the configuration, with name specified as one of parameters |
StepParameters |
currentStepParameters Actual parameter values |
FWLog |
fwLogger |
java.lang.String |
pluginProjectName Full name of the plugin's project |
java.util.Map<java.lang.String, java.lang.String> |
pluginValues #pluginValues() |
java.lang.String |
procedureName ContextFactory.procedureName |
java.lang.String |
runContext Name of the CloudBees CD context in which we are running ('pipeline', 'schedule', 'procedure') |
StepParameters |
runtimeParameters Combined values from both configuration and actual parameters |
java.lang.String |
stepName ContextFactory.stepName |
Constructor and description |
---|
Context
(java.lang.Object pluginValues, java.lang.String procedureName, java.lang.String stepName) Constructor. |
Type Params | Return Type | Name and description |
---|---|---|
|
void |
applyStepResult() Applies current StepResult |
|
void |
bailOut(java.lang.String message, java.lang.String suggestion = null, java.lang.Throwable caused = null) Immediately aborts current execution and exits with exit code 1. |
|
java.lang.String |
buildPluginProjectName() Builds name of the project for current plugin version @return |
|
java.lang.String |
getConfigName() Gets name of the config specified as a value for one of the step parameters. |
|
Config |
getConfigValues() This method returns a Config object that represents plugin configuration. |
|
java.lang.String |
getCurrentProcedureName() Retrieves name for a procedure we are running in. |
|
java.lang.String |
getCurrentProjectName() Returns current runtime context project name. |
|
java.lang.String |
getCurrentScheduleName() This method retrieves name of the current schedule we are running inside or an empty string |
|
java.lang.String |
getRunContext() Cached accessor for Context.determineRunContext |
|
StepParameters |
getRuntimeParameters() Handy shortcut for receiving the configuration and procedure parameters. |
|
StepParameters |
getStepParameters() This method returns representation of current procedure parameters |
|
boolean |
isCheckConnectionInCreateConfiguration() Checking if we are running in a specific step. |
|
boolean |
isParameterRequired(java.lang.String parameterName) Checks if the parameter with a specified name is required. |
|
REST |
newRESTClient(RESTConfig restConfig = null) Reads configuration values and instantiates new REST client for the configuration. |
|
StepResult |
newStepResult() Renews a StepResult linked to the current context. |
|
protected static java.lang.Object |
parseBooleanPropertyValue(java.lang.Object value, java.lang.String description) Internal method for parsing different boolean representations. |
|
Credential |
readActualCredential(java.lang.String credentialName, java.lang.String parameterName = credentialName) Read the values of the credential in current context. |
|
java.lang.String |
readActualParameter(java.lang.String parameterName) Read the value of an actual parameter in current context. |
|
Config |
retrieveConfigByNameAndLocation(java.lang.String configName, java.lang.String configLocation = 'ec_plugin_cfgs') Reads the specified property sheet and converts the properties to the Parameter or Credential objects. |
|
static java.lang.String |
retrieveCurrentProjectName(java.lang.String jobId) Retrieves name of the project where current running job was started @return |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Name of the configuration specified as one of the parameter values.
Full name of the project we are running in
Values from the configuration, with name specified as one of parameters
Actual parameter values
Full name of the plugin's project
Name of the CloudBees CD context in which we are running ('pipeline', 'schedule', 'procedure')
Combined values from both configuration and actual parameters
Constructor.
pluginValues
- pluginValuesprocedureName
- name of the plugin's procedure we are running in.stepName
- name of the procedure's step we are running in.Applies current StepResult
Immediately aborts current execution and exits with exit code 1. Additionally following properties will be set:
Builds name of the project for current plugin version
Gets name of the config specified as a value for one of the step parameters.
This method returns a Config object that represents plugin configuration.
Retrieves name for a procedure we are running in. If retrieving fails, using plugin's procedure name.
Returns current runtime context project name.
This method retrieves name of the current schedule we are running inside or an empty string
Cached accessor for Context.determineRunContext
Handy shortcut for receiving the configuration and procedure parameters.
This method returns representation of current procedure parameters
Checking if we are running in a specific step.
Checks if the parameter with a specified name is required.
parameterName
- name of the parameter to checkReads configuration values and instantiates new REST client for the configuration. This method expects that configuration contains specific fields. If there is only one case for the parameter, you can specify it in the special section of the pluginValues() map.
Renews a StepResult linked to the current context.
Internal method for parsing different boolean representations.
value
- string that contains either '0', '1', 'true' or 'false'.description
- preferably the parameter name, will be included to an error message if value is not boolean like.Read the values of the credential in current context.
Read the value of an actual parameter in current context.
Reads the specified property sheet and converts the properties to the Parameter or Credential objects.
configName
- name of the configurationconfigLocation
- property sheet containing the configurationsRetrieves name of the project where current running job was started
Groovy Documentation