For the complete documentation index, see llms.txt. This page is also available as Markdown.

Common delegate initialization scripts

Learn about delegate initialization scripts for installing applications and running commands on delegate pods, hosts, and containers.

You can run scripts on Harness Delegate pods, hosts, and containers to install applications or run commands.

For more information about running scripts, go to Build custom delegate images with third-party tools. This topic provides information on script availability and some common delegate initialization scripts.

Limitations

  • When you edit or delete scripts, the binaries that were already installed by those scripts are not automatically removed. To remove them, you must restart or clean up the pod or VM.

  • You cannot use Harness secrets in scripts. This is because the script runs before the delegate is registered with and establishes a connection to Harness.

Review: What can I run In a script?

You can add any command that the host, container, or pod running the delegate supports. Linux shell commands are most common. If kubectl, Helm, or Docker is running on the host, container, or pod where you install the delegate, you can use those commands. Kubernetes and Docker delegates include Helm.

The base image for the delegate uses the Red Hat Universal Base Image (Red Hat/UBI8). This means you can use any default Red Hat package in the delegate script.

Harness Delegate

Harness Delegate is packaged with cURL and tar.

When is the script executed?

Delegate scripts are applied under the following conditions:

  • New Delegate. Scripts added on delegate creation run before the delegate starts.

  • Running Delegate. Scripts applied during delegate runtime, either by application as a new script or by switching the Delegate's current script, run on delegate restart, before the delegate reaches steady state.

Unzip

Run microdnf update before you run microdnf commands.

Terraform

Here is an example of a script for installing Terraform:

Helm 3

You do not need to add a script for Helm 3. Harness includes Helm 3 support in any Delegate that can connect to the target Kubernetes cluster.

Pip

Run microdnf update before you run microdnf commands.

AWS CLI

The following script installs the AWS CLI version 2 on the delegate host.

AWS describe instance

The following script describes the EC2 instance based on its private DNS hostname:

The value for the Values parameter is the hostname of the delegate.

AWS List All Instances in a Region

The following script lists all the EC2 instances in the region you specify:

Git CLI

Run microdnf update before you run microdnf commands.

Cloud Foundry CLI

Harness supports Cloud Foundry (CF) CLI version 7 only. Below is an example of CF CLI installation; the version of the CF CLI that you install on the delegate should match the PCF features you use in your Harness PCF deployment.

For example, if you are using buildpacks in the manifest.yml file of your Harness service, the CLI you install on the delegate must be the same version or later.

In order to install the PCF CLI, follow their installation instructions for Debian and Ubuntu distributions.

Last updated

Was this helpful?