Add Service Command Templates into Command Units

Updated 3 weeks ago by Archana Singh

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

To create a Service Command Unit, do the following:

  1. In a Template Library (Application or Shared), create the individual Service commands that you want to use as a unit.
  2. Create a Service Command Unit by adding the Service commands to one Service Command.
    1. Click Add Template, and click Service Command.
    2. In Name, enter a name for the new Service command.
    3. 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.
    4. Click Submit. The Service Command is created.
    5. Click Add to add the subordinate Service commands. The Service commands in the same folder are displayed.
    6. Click a command. The command's dialog appears, and you can change any variables in the command.
    7. 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.
    8. 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.
      1. You can also add the same Service command more than once and Harness will add a -number suffix to their names.
      2. You can also use different versions of the same command in the unit:
      3. You can also add a variable to the parent Service command, and use it in a subordinate Service command.
    9. 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.
    10. 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:

Template Library

  1. In the Workflow, click Add Command, and select the Service Command Unit from a Template Library.

Service in the Workflow

  1. 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.

Notes

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.

Next Steps


How did we do?