Skip to main content

Trigger a Deployment using a URL

For Build Workflows or a  Build and Deploy Pipeline, you can trigger deployments in response to a Git event using Webhooks. This is described in Trigger Deployments using Git Events.

Once you have created a Harness On Webhook Event Trigger, Harness creates a Manual Trigger for it.

You can do the following with a Manual Trigger:

In this topic, we will cover triggering a deployment using a URL provided by Harness.

This option is used to execute a Build Workflow or a Build Pipeline only.

Before You Begin


In the Actions section of the Trigger, the Deploy only if files have changed option is available for Workflows deploying Kubernetes or Native Helm Services only.

Step 1: Create the Git Webhook Trigger

Follow the steps in Trigger Deployments using Git Events.

When you are finished, the Trigger is displayed in the Triggers list, and includes a Manual Trigger option.

Step 3: Show cURL Command

The cURL command for executing a deployment is provided by every Trigger of type On Webhook Event.

In Triggers, locate the Trigger you want run.

Click Manual Trigger.

In the Manual Trigger settings, click Show Curl Command. The cURL command is displayed.

When you created a Trigger, if you selected values for parameters that are represented by placeholders in the cURL command, you do not need to add values for the cURL placeholders.

If you add values for the cURL placeholders, you will override manual settings in the Trigger.

This is also true for Triggers that execute templated Workflows and Pipelines. If you create a Trigger that executes a templated Workflow or Pipeline, you can select values for the templated settings in the Trigger, but you can still override them in the cURL command.

Let's look at a placeholder example:

curl -X POST -H 'content-type: application/json' \  
--url \
-d '{"application":"xxxxxx","artifacts":[{"service":"micro-service","buildNumber":"micro-service_BUILD_NUMBER_PLACE_HOLDER"}]}'

For service, enter the name of the Harness Service.

For buildNumber, enter the artifact build number from the Artifact History in the Service.

For example:

curl -X POST -H 'content-type: application/json' \  
--url \
-d '{"application":"xxxxxx","artifacts":[{"service":"Service-Example","buildNumber":"1.17.8-perl"}]}'

Step 3: Run the cURL Command

Once you have replaced the placeholders, run the cURL command.

The output will be something like this (private information has been replaced with xxxxxx):


The uiUrl can be used directly in a browser. apiUrl can be used to track deployment status programmatically, such as using a REST call.

Step 4: View Deployment Using the URL

The uiUrl from the cURL command output can be used directly in a browser.

To run a deployment from a browser, paste the URL from uiUrl into the browser location field and hit ENTER.

The browser will open and display the running deployment.

Configure As Code

To see how to configure the settings in this topic using YAML, configure the settings in the UI first, and then click the YAML editor button.