7 - Triggers

Updated 2 days ago by Michael Cretzman

Triggers automate deployments using a variety of conditions, such as Git events, new artifacts, schedules, and the success of other pipelines. 

Now that you have an Artifact Build and Deploy Pipeline, you can create a Harness Trigger that runs the Pipeline in response to a Git push to the source repo. The Trigger provides a Webhook URL you can add to your Git repo.

When the push event happens, Git sends a HTTP POST payload to the Webhook's configured URL. The Trigger then executes Artifact Build and Deploy Pipeline.

To add a Trigger, do the following:

  1. In your Harness Application, click Triggers, and then click Add Trigger. The Trigger dialog appears.
  2. In Name, enter a name for your Trigger, such as Build and Deploy
  3. Click Next.
  4. In Condition, in Type, select On Webhook Event.
  5. In Repository Type, select the Git repo, such as GitHub.
  6. In Event Type, choose On Push. At this point, the Trigger will look something like this:
  7. Clic Next.
  8. In Actions, in Execution Type, select Pipeline
  9. In Execute Pipeline, select your Artifact Build and Deploy Pipeline.
  10. Click Next and then SUBMIT. The Trigger is created.

  1. Click GitHub Webhook. The Trigger dialog appears.
  2. Copy the Webhook and use it in GitHub to trigger the deployment.
  3. When you set up the Webhook in GitHub, modify the Content type to application/json
  4. In Which events would you like to trigger this webhook?, select Just the push event.

Save your Webhook. The next time a push even occurs, the Harness examines any incoming payload to ensure that it meets the Action you set in your Trigger. The Trigger you created will run, executing your Artifact Build and Deploy Pipeline.

Next Steps


How did we do?