Back to index
Summary
Sets an output parameter value.outputParameterNameStringrequiredThe name of the output parameter. valueStringrequiredThe value of the output parameter. flowRuntimeIdUUIDoptionalThe primary key or name of the flowRuntime container of the property sheet that owns the property. jobIdUUIDoptionalThe ID of the job. jobStepIdUUIDoptionalThe primary key of the job-step container of the property sheet that owns the property. |
Usage
Perl
$cmdr->setOutputParameter( "test-outputParameterName", # outputParameterName "test-value" # value # optionals );
ectool
ectool setOutputParameter \ "test-outputParameterName" `# outputParameterName` \ "test-value" `# value` \ # optionals
Examples
Perl
$cmdr->setOutputParameter("myOutputParam", "abc", {jobId => "7d65baa4-4ff9-11e8-9f14-0050568f29b0"});
ectool
ectool setOutputParameter "myOutputParam" "abc" --jobId 7d65baa4-4ff9-11e8-9f14-0050568f29b0
DSL example
The following DSL example shows how to use output parameters and the setOutputParameter
API command:
/* CloudBees CD/RO DSL code illustrating the use of output parameters introduced in version 8.3. The procedure takes an input value and outputs a modified version of the input. The pipeline contains a stage with two tasks. The first task calls the procedure and uses the procedure output to set a state summary value. The second task sets a pipeline output parameter based on the preceding task procedure output. Instructions 1. Run the DSL through EC-DSLIDE or from the command line: - ectool evalDsl --dslFile outputParameters.groovy 2. Run the pipeline, Project Name: Output Parameters, Pipeline Name: Output parameter 3. Examine - Stage summary - Pipeline parameters */ project "Output Parameters",{ procedure "Generate Output",{ formalParameter "Input", defaultValue: "Input value" formalOutputParameter "ProcedureOutput" step "Set output parameter", command: 'ectool setOutputParameter ProcedureOutput \"$[/javascript "Input was: " + getProperty("Input").value]\"' } pipeline "Output parameter",{ formalOutputParameter "PipelineOutput" stage "Stage 1",{ task "Run output parameter procedure", taskType: 'PROCEDURE', subproject: 'Output Parameters', subprocedure: 'Generate Output', actualParameter: ["Input": "Procedure Input value"], stageSummaryParameters: '[{"name":"ProcedureOutput","label": "Procedure Output:"}]' task "Use output parameter", taskType: 'COMMAND', actualParameter: ["commandToRun": 'ectool setOutputParameter PipelineOutput "$[/myStageRuntime/tasks/Run output parameter procedure/job/outputParameters/ProcedureOutput]"'] } // stage } // pipeline } // project
For details about using DSL, refer to Use the CloudBees CD/RO domain-specific language (DSL).