Triggers in pipelines

Choose when your pipelines should run

To create an effective CI/CD process, it should be possible to trigger a Codefresh pipeline execution not only on code repository events (like push or PR), but also on any “interesting” CD-related event, coming from some external system.

Codefresh not only allows you to define different pipelines on a single project but it also offers you the capability to trigger them with completely separate mechanisms.

Pipeline trigger types

The following types of triggers are currently supported in pipelines:

As an example, this project contains four pipelines:

Sample pipelines

Sample pipelines

Behind the scenes these pipelines are triggered from different events:

  • Pipeline “CI-build” uses a GIT trigger and starts after every commit to the code repository
  • Pipeline “Sonarcloud” is executed every weekend using a cron (timed) trigger
  • Pipeline “integration-test” is executed whenever a commit happens in a Pull request on the code
  • Pipeline “deploy-prod-k8s” is executed whenever a Docker image is pushed to the Docker registry

This is just an example. You are free to create your own triggers that match your own internal process. It is also possible to add multiple triggers for a pipeline so that it is executed for more than one type of events.

If a pipeline has no defined trigger you can still start it manually.

You can also manage all trigger types using the Codefresh CLI.

Creating a new trigger for a pipeline

By default, when you create a new project from a Git provider, it will start with a Git trigger that runs on every commit.

Default GIT Trigger

Default GIT Trigger

You can either delete this trigger, modify it, or add new ones.

To add a new trigger, go to the Triggers tab in your pipeline editor and click the Add Trigger button. This will bring up the respective dialog where you are adding a new trigger.

Adding new Trigger dialog

Adding new Trigger dialog

For more information, see Pipeline trigger types

Disabling triggers

You can easily disable a trigger manually if you don’t want it to be active anymore. On the triggers tab, click the gear icon on the top right (Open advanced options).

Toggle a trigger on/off

Toggle a trigger on/off

Then click the toggle switch on each trigger that you want to enable/disable. You can later enable the same trigger again by clicking the same switch.

For Git triggers, you can also skip triggering the pipeline without disabling the trigger by adding a predefined string to the commit message. See Skip triggering pipeline on commit.

Creating pipelines
Running pipelines locally
Trigger a Kubernetes deployment from a Docker Hub push event