You can trigger Harness Workflow and Pipeline deployments when specific Harness Pipelines complete their deployments.
For example, you might create a Pipeline to test a deployment in one environment. When it completes its deployment, a Trigger executes a second Pipeline to deploy to your stage environment.
Before You Begin
Supported Platforms and Technologies
Step 1: Add a Trigger
Typically, Triggers are set up after you have successfully deployed and tested a Workflow or Pipeline.
To add a trigger, do the following:
- Ensure that you have a Harness Service, Environment, and Workflow set up. If you want to Trigger a Pipeline, you'll need one set up also.
- In your Harness Application, click Triggers.
- Click Add Trigger. The Trigger settings appear.
- In Name, enter a name for the Trigger. This name will appear in the Deployments page to indicate the Trigger that initiated a deployment.
- Click Next.
Step 2: Select the Pipeline the Initiates this Trigger
- In Condition, select On New Pipeline.
- In Pipeline, select the Pipeline that will initiate this Trigger when the Pipeline completes its deployment.
- Click Next.
Step 3: Select the Workflow or Pipeline to Deploy
- In Execution Type, select Workflow or Pipeline.
- In Execute Workflow/Pipeline, select the Workflow or Pipeline to deploy.
Step 4: Provide Values for Workflow Variables
If the Workflow or Pipeline you selected to deploy uses Workflow variables, you will need to provide values for these variables.
You can also use variable expressions for these values. See Passing Variables into Workflows from Triggers.
Step 5: Select the Artifact to Deploy
Since Workflows deploy Harness Services, you are also prompted to provide the Artifact Source for the Service(s) the Workflow(s) will deploy.
There are three main settings:
From Triggering Artifact Source
Select this option to use the artifact identified in Artifact Source you selected in Condition.
Select this option to use the last artifact collected by Harness in the Harness Service. Artifact metadata is collected automatically every minute by Harness.
You can also manually collect artifact metadata using the Service's Manually pull artifact feature.
Last Successfully Deployed
The last artifact that was deployed by the Workflow you select.
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.
- Passing Variables into Workflows from Triggers
- For information on using Triggers as part of Harness Git integration, see Onboard Teams Using Git.
- Trigger Deployments When a New Artifact is Added to a Repo
- Schedule Deployments using Triggers
- Trigger Deployments using Git Events
- Trigger a Deployment using cURL
- Trigger a Deployment when a File Changes
- Get Deployment Status using REST
- Pause All Triggers using Deployment Freeze