Create a Service Command Template

Updated 3 weeks ago by Archana Singh

You can use Template Library to create templates of scripts and other commands and copy or link them into Harness Services and Workflows.

To add bash and PowerShell commands to Services, you can create templates using a Service Command template. You can add variables to the template and have values supplied to the variables in the Service using the template.

Only members of a Harness User Group with the Manage Template Library permission may create, edit, and delete Account and Application-level templates. Members of a User Group with this permission disabled can view and link to templates only.

In this topic:

Before You Begin

Step: Create a Service Command

To create a Service Command, do the following:

  1. Click Setup.
  2. In Account, click Template Library.
  3. Click the template folder where you want to add your new template.
  4. Click Add Template and select the Service Command template type. The Add Service Command Template settings appear.
  5. Enter a name and description for the command.
  6. In Variables, click Add to add variables to the template. You can set a default value. The variable value can be supplied or replaced when the template is used in a Service.
  7. Click Submit. The new Service Command template is created.
  8. Hover over Add to see the list of available subcommands to add to the template.
  9. Click a subcommand to see its script and make any changes.
  10. To use the template in a Service, click Add Command in the Service and then click From Template Library. The template is displayed.
  11. Click Link to link to the template. You can then edit the template in your Service, providing values for the variables in the template. When you use this Service in a Workflow, the Service command will be available as a step.

Next Steps

How did we do?