Skip to main content

Create triggers

In Harness, you can create triggers to automatically run your CI/CD pipelines in response to push events in your Harness Code repos.

You can configure Harness Code webhook triggers in the visual or YAML editors.

  1. Go to the pipeline where you want to add a trigger for a Harness Code repository.
  2. Make sure your Harness Code repo is the pipeline's default codebase.
  3. Select Triggers in the Pipeline Studio header.
  4. Select New Trigger, and select the Harness webhook trigger type.
  5. Enter a trigger Name, select the Repository, Event, and Actions that you want the trigger to listen on, and, if desired, select specific stages to run for this trigger.
  6. On the Conditions tab, you can refine the trigger by specifying conditions that must also apply in addition to the previously-specified Event and Actions. For example, you can create a trigger that runs only when a Pull Request (event) is opened (action) against your main branch (condition).
  7. On the Pipeline Input tab, if your pipeline accepts any runtime input, you can provide values that you want the trigger to use for these inputs.
  8. Save the trigger.
  9. To test the trigger, create a PR or push a change to your Code repository.

Permissions required for creating and updating Triggers

Triggers creation are supported with two modes of permissions

  1. Mandatory Mode : Users need both pipeline creation/editing and pipeline execution permissions.
  2. Optional Mode : Users can create/edit pipelines and execute them, but it's not mandatory.

This can be enabled using the settings available at Project level as part of the pipeline settings group

You have the option to turn off the necessary permissions for creating or editing pipelines in order to manage triggers separately. By doing this, you can allow only specific users to edit the pipeline while still enabling them to create or update triggers.