I’ve had a few conversations around integrations with Harness and other tools, what is and is not supported, and even when certain integrations will be coming. One of the great things about a Software-as-a-Service like Harness is that you get rapid integration support with use-case-directed development.
Obviously, we will need to supplement a stop-gap for some of these integrations in the meantime. The technology integration that this post covers will be Python Scripts in Harness
The first step will be to get Python on the Delegate using a Delegate Profile. You will need to add
apt-get update -y
apt-get install python3 -y
to the top of the delegate profile and then add
python3 --version to the bottom to make sure that you get the correct version out of it. (Note: Depending on the type of Delegate you are using, you might need
sudo, so if the above doesn’t work because of permissions issues, try the
Then, you’ll need to assign the Delegate Profile to the Delegate, add a Delegate Selector to the Delegate, and then wait for the Delegate Profile logs to show and validate that everything was installed correctly.
Selector is at the bottom (demo-worker) and the Delegate Profile is near the top (Demo Delegate) with a timestamp (…executed at 07/24/2020 10:14 am…) and a View Logs link to the right to see what the output was
Python Template Setup
After the Delegate is ready, you’ll want to go to the Template Library and create a new Shell Script Template and add the Python Code:
In this case, we are doing a simple double loop with Hello World in it
python3 -c '
for r in range(3):
for a in range(2):
To test this out in Harness, you will need to go to the desired Application and add it to an existing Workflow or a new Workflow.
Run the Deployment and now you will see the Python output in the workflow:
You could just add the Python piece directly in the Workflow without the Template Library involved. The reason I recommend this approach is because you can sync the Template Library to your Git Repo in the Configuration Code side of Harness, allowing you to update the Python Script in Git. This also allows you to assign a designated version of the Python Code to the workflow while you work on the improvements (check out the versioning in the Template Library).
If you have found a different/better way to run Python in Harness, let me know in the comments!
I will update this post as some functionality is improved or if new issues arise.
Don’t forget to Comment/Like/Share!