Add Service Command Templates into Command Units
You can add multiple Service commands into a single template as a Service Command Unit. You can share and change variables across the commands in the unit, and then use the unit in Services and Workflows just like an individual Service command.
Here is an example of a Service Command Unit named MyServiceTest that contains the Service command MeetAndCheck and two instances of the Service command ServiceCheck.
In this topic:
- Before You Begin
- Step 1: Create a Service Command Unit
- Step 2: Add Service Command Unit to a Workflow
- Next Steps
Before You Begin
Step 1: Create a Service Command Unit
To create a Service Command Unit, do the following:
- In a Template Library (Application or Shared), create the individual Service commands that you want to use as a unit.
- Create a Service Command Unit by adding the Service commands to one Service Command.
- Click Add Template, and click Service Command.
- In Name, enter a name for the new Service command.
- In Variables, add any variables that you want to use in the subordinate commands. You can leave Variables empty, and when you add subordinate commands their variables will be added to the Variables section.
- Click Submit. The Service Command is created.
- Click Add to add the subordinate Service commands. The Service commands in the same folder are displayed.
- Click a command. The command's dialog appears, and you can change any variables in the command.
- Click Submit.
If you click the parent Service Command Unit's name you will see that the variable from the subordinate Service command you added is now in the parent Service command's Variables section.
- Add any more Service commands to the unit. All of the variables used in the subordinate commands are also added to the parent Service command's Variables section.
- You can also add the same Service command more than once and Harness will add a -number suffix to their names.
- You can also use different versions of the same command in the unit:
- You can also add a variable to the parent Service command, and use it in a subordinate Service command.
- When you are done, link the Service Command Unit to a Service. In the Service, click Add Command, and select the Service Command Unit from a Template Library by clicking its Link button.You will be prompted to replace any Service command variables.
- Change any variables, if needed, and click Submit. The Service Command Unit is added to the Service.
Step 2: Add Service Command Unit to a Workflow
The Service Command Unit can be added to Workflow in two ways:
- In the Workflow, click Add Command, and select the Service Command Unit from a Template Library.
Service in the Workflow
- When you create a Workflow you select a Harness Service to deploy. If the Service contains a Service Command Unit, click Add Command and the Service Command Unit is available in the Commands options.
The same Service Command Unit added from the Template Library is different from the Service Command Unit added via the Service:
- The Service Command Unit added from a Template Library will contain the variable values set in the Template Library.
- The Service Command Unit added from the Service will contain the variable values set in the Service.