Create a Shell Script Workflow Step 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. Templates are created in the Template Library. Each template can have multiple versions with unique variables.

When creating a template, type ${...} in a field, then enter the variable name to create a template variable.

Shell Script templates contain Bash and PowerShell commands and parameters. You can enter variables into the template, apply the template to Workflows, and have the Workflow enter Workflow-specific values for the command.

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 Shell Script Template

To create a Shell Script template, 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 Shell Script template type. The Add Shell Script Template settings appear.
  5. Enter a name for your script. Use a name that describes the purpose of the script.
  6. In Script, fill out the Shell Script command as described in Using the Shell Script Command. The article describe how to create variables in the template, for example, ${myVar}.
  7. Click Submit to create the script. The script appears with a list of the variables you created.
  8. Next, apply the Shell Script template as a command in a Workflow. In a Workflow, simply click Add Command, and select Template Library. The Shell Script template appears.
  9. Click Link to link to the template. You can then edit the template in your Workflow, providing values for the variables in the template.

    The following table displays the Shell Script template in the Template Library and the applied template in a Workflow. Notice how the variable names defined in the template are greyed out in the applied template, and only the variable values are editable:

    Template in Template Library

    Template Applied in a Workflow


    Once the Shell Script template is linked and added to the workflow, a link icon appears next to the command:

Next Steps


How did we do?