Storing and Retrieving Properties in a Job
This tutorial shows you how to create, set, and retrieve properties stored on a job.
To view an example procedure for this tutorial , go to the automation platform UI > Projects > EC-Tutorials- <version> , and click the procedure name.
An explanation of what you see:
This procedure implements two steps.
Write data to a property attached to the running job: "Step 1—Create a property attached to the job" calls ectool to create a property name
The path to the property being set is "
$[/myJob]is a shortcut to the running job name and can be used while the job is running. If the job number was 1000, the path "
/jobs/$[/myJob]/property1" might expand to "
Read data from the property created in Step 1: "Step 2—Read the property attached to the job by Step 1"—this step could read step values stored on a job, running as part of the job, or could be executed using a simple property expansion.
In this case,
property1was set in Step 1 and is referenced in Step 2 using the
Two other ways to reference a property (shown by example in the Action column):
Click Run to run this sample procedure and see the resulting job on the Job Details page.
After the job completes, click the icon in the Log column for Step 2 to view three lines each showing the data (the property value) that was stored in the property that was retrieved.
If you need to retrieve properties, adapt these concepts to your procedures.
For help getting started, click on a step name in the tutorial procedure to go to the corresponding Edit Step page.
You can reuse the text supplied in the Command(s) box, changing the "property1" name and other values to those more meaningful to your project/procedure.
|Any changes you make within this tutorial will not be saved when you upgrade CloudBees CD.|