4 - Commands and Scripts
When you create the Harness Service, Harness automatically-generates the commands and scripts needed to install the app and stack on the target host, copy the file(s) to the correct folder, and start the app.
In this topic, we will discuss the default commands and scripts, and their processing order:
- Add Commands and Scripts
- Script Execution Order
- Download Artifact and Exec Scripts
- Harness and Custom Variables
- Next Step
Add Commands and Scripts
You can add commands and scripts using the Add Command settings, and by clicking the plus icon in the commands.
All of the scripts include tooltips to explain how to use them:
Script Execution Order
When you look at the default commands in a file-based Service, their order of execution might be confusing. For example, it looks like they are executed like this:
But they are actually executed like this:
The order is clearer when you see the deployment in the Deployments page:
Download Artifact and Exec Scripts
The Download Artifact script is supported for Amazon S3, Artifactory, and for PowerShell, the SMB and SFTP artifact sources. For other artifact sources, add a new command and use the Exec script to download the artifact. For more information, see Exec Script.
Harness and Custom Variables
You can use Harness built-in variables in your Service scripts, or add your own variables and reference them in your scripts.