Skip to main content

Pipeline Triggers

This tutorial will help you to get started with triggers in Harness pipelines.

Why use triggers?

Triggers in a Harness Continuous Delivery (CD) pipeline are used to automatically initiate pipeline stages or actions based on specific events or conditions, such as Git events, new Helm Charts, new artifacts, or specific time intervals. Triggers in Harness CD enable faster feedback cycles, enhanced efficiency, and decreased reliance on manual intervention during the deployment process.

Before you begin

Verify the following:

  • Existing Harness CD pipeline. If you are a new user or haven't created a pipeline yet, then kindly check our CD tutorials to create one.
  • Existing GitHub connector.
    • If you are a new user or haven't created a Git connector yet, fork the harnesscd-example-apps repository through the GitHub web interface, then kindly follow the steps in Git Connector to create one and point the connector to the fork.

Implement a trigger using Git events

  1. Log into Harness.

  2. Select Projects, and then select Default Project.

    caution

    For the pipeline to run successfully, please follow all of the following steps as they are, including the naming conventions.

  3. In Default Project, select Pipelines.

    • Select an existing pipeline or create a new pipeline by following any of our CD tutorials.
  4. After choosing the pipeline, select Triggers.

    • Select New Trigger and choose GitHub under Webhook.

    • Now, toggle to YAML to use the YAML editor.

    • Copy the contents of github-trigger.yml and paste it into the YAML editor.

    • In the YAML, replace ORGANIZATION_ID, PROJECT_ID, PIPELINE_ID and GITHUB_CONNECTOR with the organization identifier, project identifier, pipeline identifier and GitHub connector identifier respectively.

    • Finally, select Create Trigger.

    • You can also switch to the Visual editor and confirm the trigger steps.

  5. Now, edit the README.md of the forked harnesscd-example-app repo and push the changes.

  6. Finally, see the pipeline triggered and deploying the new changes.

Congratulations!🎉

You've just learned how to implement triggers in a Harness CD pipeline.

What's Next?