Skip to main content

Trigger Deployments when Pipelines Complete

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

See  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:

  1. 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.
  2. In your Harness Application, click Triggers.
  3. Click Add Trigger. The Trigger settings appear.
  4. In Name, enter a name for the Trigger. This name will appear in the Deployments page to indicate the Trigger that initiated a deployment.
  5. Click Next.

Step 2: Select the Pipeline the Initiates this Trigger

  1. In Condition, select On New Pipeline.
  2. In Pipeline, select the Pipeline that will initiate this Trigger when the Pipeline completes its deployment.
  3. Click Next.

Step 3: Select the Workflow or Pipeline to Deploy

  1. In Execution Type, select Workflow or Pipeline.
  2. 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.

Last Collected

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.