attachParameter
Attaches a formal parameter to a step. Attaching a parameter allows a step to use the credential (passed in a parameter) as an actual parameter to a subprocedure call or directly in a getFullCredential
call in a command step. For more information about parameters, go here .
You must specify projectName
and formalParameterName
.
The attachParameter command in CloudBees CD/RO 6.0 and newer releases is not compatible with previous CloudBees CD/RO releases.
|
Arguments | Descriptions |
---|---|
projectName |
Name of the project. This name must be unique among all projects. Argument Type: String Argument Type: String |
formalParameterName |
Name of the parameter. Argument Type: String |
procedureName |
(Optional) Name of the procedure to which the parameter is attached. Argument Type: String |
stepName |
(Optional) Name of the procedure step to which the parameter is attached. Argument Type: String |
applicationName |
(Optional) Name of the application to which the parameter is attached. Argument Type: String |
componentApplicationName |
(Optional) Name of the component in the application to which the parameter is attached. Argument Type: String |
componentName |
(Optional) Name of the component to which the parameter is attached. Argument Type: String |
gateType |
(Optional) The type of the gate to which the parameter is attached: POST or PRE. Argument Type: GateType |
pipelineName |
(Optional) Name of the pipeline to which the parameter is attached. Argument Type: String |
processName |
(Optional) Name of the process to which the parameter is attached. Argument Type: String |
processStepName |
(Optional) Name of the process step to which the parameter is attached. Argument Type: String |
releaseName |
(Optional) Name of the release to which the parameter is attached. Argument Type: String |
serviceName |
(Optional) Name of the service. Argument type: String |
stageName |
(Optional) Name of the task to which the parameter is attached. Argument Type: String |
stateDefinitionName |
(Optional) Name of the workflow state definition to which the parameter is attached. Argument Type: String |
taskName |
(Optional) Name of the task to which the parameter is attached. Argument Type: String |
workflowDefinitionName |
(Optional) Name of the workflow state definition to which the parameter is attached. Argument Type: String |
createActualParameter
Creates a new actual parameter for a step that calls a nested procedure. The parameter is passed to the nested procedure when the step runs. At runtime, the actual parameter name must match the name of a formal parameter in the nested procedure.
Passing Actual Parameters
You can use actual parameters in three types of API calls:
-
calling
runProcedure
to start a new job -
setting up a schedule
-
creating or modifying a subprocedure step
For example, when you call runProcedure
using ectool, set the actual parameters to the procedure on the command line using the optional argument --actualParameter
, followed by a list of name/value pairs. The following is an example of calling a procedure named MasterBuild:
ectool runProcedure "project A" --procedureName "MasterBuild"`
--actualParameter Branch=main Type=Debug`
To make this call using the Perl API, define a list. Each element of the list is an anonymous hash reference that specifies one of the actual parameters. Now you can pass a reference to the list as the value of the actualParameter
argument.
Here is the same example called via the Perl API:
# Run the procedure $xPath = $cmdr\->runProcedure("project A", {procedureName => "MasterBuild", actualParameter => [ {actualParameterName => 'Branch', value => 'main'}, actualParameterName => 'Type', value => 'Debug'}, ]});
Specifying most arguments to the createStep
API in Perl is fairly intuitive; like any other API, you specify key-value pairs in a hash argument for all optional parameters. However, specifying actual parameters is more involved because actual parameters are not arbitrary key-values characterizing the step. Instead, they are key-values characterizing actual parameters to the step. See the following createStep
request in XML:
<createStep> <projectName>MyProject</projectName> <procedureName>MyProcedure</procedureName> <stepName>Step1</stepName> <actualParameter> <actualParameterName>parm1</actualParameterName> <value>myval</value> </actualParameter> <actualParameter> <actualParameterName>parm2</actualParameterName> <value>val2</value> </actualParameter> </createStep>
Each actual parameter key-value is under an <actualParameter>
element. Code this in the optional arguments hash in the Perl API like this:
{ ..., => ..., actualParameter => [{actualParameterName => 'parm1', value => 'myval'}, {actualParameterName => 'parm2', value => 'val2'}], ... => ...}
In other words, the value of the actualParameter
key in the optional arguments hash is a list of hashes, each representing one actual parameter. If the sub-procedure call takes only one actual parameter, the value of the actualParameter
key can be specified as just the hash representing the one parameter:
actualParameter => {actualParameterName => 'parm1', value => 'myval'}
You must specify projectName
, procedureName
, stepName
, and actualParameterName
.
Arguments | Descriptions |
---|---|
projectName |
Name of the project containing the procedure. The project name must be unique among all projects. Argument type: String |
procedureName |
Name of the procedure containing the step. Argument type: String |
stepName |
Name of the step that calls a subprocedure. Argument type: String |
actualParameterName |
The name of the parameter. This name must be unique within the step, and at runtime, it must match the name of a formal parameter in the subprocedure. Argument type: String |
applicationName |
(Optional) Name of the application when the actual parameter is on an application process step. Argument type: String |
componentName |
(Optional) Name of the component when the actual parameter is on a component process step. Argument type: String |
dashboardName |
(Optional) Name of the dashboard. Argument type: String |
flowName |
(Optional) Name of the flow. Argument type: String |
flowStateName |
(Optional) Name of the flow state. Argument type: String |
processName |
(Optional) Name of the process when the actual parameter is on a process step. Argument type: String |
processStepName |
(Optional) Name of the process step when if the actual parameter is on a process step. Argument type: String |
releaseName |
(Optional) Name of the release if the actual parameter is on a release. Argument type: String |
scheduleName |
(Optional) Name of the schedule. Argument type: String |
serviceName |
(Optional) Name of the service, if the actual parameter is on a service process step. Argument type: String |
stateDefinitionName |
(Optional) Name of the state definition. Argument type: String |
transitionDefinitionName |
(Optional) Name of the transition definition. Argument type: String |
value |
(Optional) This value is passed to the subprocedure as the value of the matching formal parameter. Argument type: String |
widgetName |
(Optional) Name of the widget. Argument type: String |
workflowDefinitionName |
(Optional) Name of the workflow definition. Argument type: String |
createFormalOutputParameter
Creates a new formal output parameter.
You must specify projectName
, procedureName
, and formalOutputParameterName
.
Arguments | Descriptions |
---|---|
projectName |
Name of the project. This name must be unique among all projects. Argument Type: String Argument Type: String |
formalOutputParameterName |
Name for this parameter; used when the procedure is invoked to specify a value for the parameter. Argument type: String |
applicationName |
(Optional) The name of the application, if the formal output parameter is on an application process. Argument type: String |
description |
(Optional) Comment text describing this object that is not interpreted at all by CloudBees CD/RO . Argument type: String |
pipelineName |
(Optional) The name of the pipeline, if the formal output parameter is on a pipeline. Argument type: String |
procedureName |
(Optional) The name of the procedure. Argument type: String |
processName |
(Optional) The name of the process, if the formal output parameter is on a process. Argument type: String |
releaseName |
(Optional) The name of the release, where pipeline is located. Argument type: String |
serviceName |
(Optional) The name of the service, if the formal output parameter is on an service process. Argument type: String |
createFormalParameter
Creates a formal parameter.
You must specify projectName
and formalParameterName
.
Arguments | Descriptions |
---|---|
projectName |
Name of the project. The project name is unique among all projects. Argument type: String |
formalParameterName |
The name for the formal parameter. Argument type: String |
applicationName |
(Optional) Name of the application when the formal parameter is on an application process step. Argument type: String |
catalogItemName |
(Optional) The name of the catalog item, if the formal parameter is on a catalog item. Argument type: String |
catalogName |
(Optional) The name of the catalog to which the Argument type: String |
componentName |
(Optional) Name of the component when the formal parameter is on a component process step. Argument type: String |
dashboardName |
(Optional) The name of the dashboard, if the formal parameter is on a dashboard. Argument type: String |
description |
(Optional) A plain text or HTML description for this object. If using HTML, you must surround your text with Argument type: String |
flowName |
(Optional) Name of the flow. Argument type: String |
flowStateName |
(Optional) Name of the flow state. Argument type: String |
gateType |
(Optional) The type of the gate: POST or PRE. Argument Type: GateType |
orderIndex |
(Optional) The display order index starting at 1. Argument type: Integer |
pipelineName |
(Optional) The name of the pipeline. Argument type: String |
procedureName |
(Optional) The name of the procedure when the formal parameter is on a procedure. |
processName |
(Optional) Name of the process when the formal parameter is on a process. Argument type: String |
processStepName |
(Optional) Name of the process step when the formal parameter is on a process step. Argument type: String |
releaseName |
(Optional) Name of the release, if the formal parameter is on a release-scoped pipeline. Argument type: String |
serviceName |
(Optional) Name of the service, if the formal parameter is on a service process. |
stageName |
(Optional) Name of the stage. Argument type: String |
stateDefinitionName |
(Optional) Name of the state definition. Argument type: String |
stateName |
(Optional) Name of a workflow state. Argument type: String |
taskName |
(Optional) Name of the task. Argument type: String |
type |
(Optional) For For all other container types, possible types include:
Argument type: String |
workflowDefinitionName |
(Optional) Name of the workflow definition. Argument type: String |
workflowName |
(Optional) Name of a workflow. Argument type: String |
Common arguments for all parameter types. |
|
defaultValue |
(Optional) This value is used for the formal parameter when a value is not provided. Do not use if Argument type: String |
dependsOn |
Comma-separated list of formal parameters on which this parameter depends to be rendered. See Cascading drop-down with parameter dependencies for an example. Argument type: String, Max length: 255 characters |
expansionDeferred |
(Optional) < Boolean flag— The default is Do not spsecify if Argument type: Boolean |
label |
(Optional) The display label. If not specified, the formal parameter name is used. Argument type: String |
renderCondition |
(Optional) Condition for rendering the formal parameter. If render conditions are defined, then
If left empty, the parameter renders by default. See Conditionally render parameters for an example. Type: String, Max length: 255 characters |
required |
(Optional) < Boolean flag— Do not use if Argument type: Boolean |
validationDSL |
(Optional) The DSL script for validating the formal parameter at runtime. This script must return an instance of String, Do not specify if Argument type: String, Max length: MAX_VALUE_LENGTH (4000 characters) |
Specify the following when |
|
options |
(Optional) Ordered list of options |
simpleList |
(Optional) Pipe-separated list of options. For example, |
optionsFromPropertySheet |
(Optional) Path to the property sheet containing the options. |
|
|
options |
(Optional) Ordered list of options. |
simpleList |
(Optional) Pipe-separated list of options. For example, |
optionsFromPropertySheet |
(Optional) Path to the property sheet containing the options. |
propertyReference propertyReferenceType |
(Optional)
|
optionsDsl |
(Optional) Dsl script for populating drop-down options. The script must return an instance of Argument type: String, Max length: MAX_VALUE_LENGTH (4000 characters) |
Specify the following when |
|
checkedValue uncheckedValue |
Checked and unchecked values rendered for the checkbox parameter. These two parameters must be used together. Argument type: String |
Specify the following when |
|
projectFormalParameterName |
The Argument type: String |
Positional arguments
In CloudBees CD/RO 5.0 and later, projectName
and formalParameterName
.
In releases earlier tha CloudBees CD/RO 5.0, projectName
, procedureName
, and formalParameterName
.
For workflow state parameters: projectName, formalParameterName, workflowDefinitionName
and stateDefinitionName
Response
Returns a formalParameter object with contents of the newly created formal parameter.
Basic validation
Custom validation logic can be applied to a parameter using a DSL script that is registered with the parameter. Here is a basic example of a DSL script that allows the user to only enter test1 ` or `test2 ` as a value in the text entry field for the parameter `paramName1
.
if (args.parameters['paramName1'] != 'test1' && args.parameters['paramName1'] != 'test2') { // return an appropriate error message in case the validation failed return "'paramName1' parameter value is not valid" } else { // an empty or null response is construed as a validation success return null }