Skip to main content

Create a custom delegate that includes custom tools

Harness delegates are installed from Harness Manager and typically contain the binaries you need for your CI/CD Pipelines.

In some cases, you might want to add more tools or even create your own custom delegate and include the tools needed for your builds and deployments.

This topic explains the different ways to create a custom Delegate.

Before you begin

Option: Use the INIT_SCRIPT environment variable

In the Delegate config file, locate the INIT_SCRIPT environment variable.

For example, here it is in the Kubernetes Delegate harness-delegate.yaml file:

apiVersion: apps/v1
kind: StatefulSet
value: |-
echo install wget
apt-get install wget
echo wget installed

In value, enter your script. For a list of common scripts, see Common Delegate Initialization Scripts.

For steps on using the INIT_SCRIPT environment variable, see Run Scripts on Delegates.

You can see all of the environment variables for the Delegates in the following topics:

Option: Add a delegate image

Harness Delegate Docker images are public and you can use them to compose your own Delegate image.

The Harness Delegate Docker images are located on Docker Hub.

For example, you can curl and install all the tool libraries you want and then curl delegate:latest to add the latest Delegate image.

Or you can create your own image and simply include the Delegate image.

Here's and example that installs Node.JS on top of a Delegate image and sets an environment variable key:value pair.

FROM harness/delegate:latest

RUN apt-get update && apt-get -y install nodejs

ENV key=value

You can see all of the environment variables for the Delegates in the following topics: