Version 1.0.0
Language EN

Triggers

Triggers can be used to limit pipeline execution at runtime. For example, if you want to limit pipeline execution by branch or by repository events (pushes, pull requests, etc). Any webhooks received by Drone that do not match the trigger criteria are discarded by the system.

Example trigger limit execution to the master branch.

kind: pipeline

steps:
- name: build
  image: golang
  commands:
  - go build
  - go test

trigger:
  branch:
  - master

You can combine multiple conditions. For exmaple, the below pipeline definition will only trigger an execution when the branch is master and the event is push.

kind: pipeline

steps:
- name: build
  image: golang
  commands:
  - go build
  - go test

trigger:
  branch:
  - master
  event:
  - push

By Branch

The branch trigger is used to trigger a pipeline based on the git branch. Please note that the target branch is evaluated for pull requests; and branch names are not available for tag events.

kind: pipeline

steps:
- name: build
  image: golang
  commands:
  - go build
  - go test

trigger:
  branch:
  - master
  - feature/*

Example include syntax:

trigger:
  branch:
    include:
    - master
    - feature/*

Example exclude syntax:

trigger:
  branch:
    exclude:
    - master
    - feature/*

By Event

The event trigger is used to trigger a pipeline based on the drone event type. This can be helpful when you want to limit pipeline execution based on push, pull request, tag and more.

kind: pipeline

steps:
- name: build
  image: golang
  commands:
  - go build
  - go test

trigger:
  event:
  - push
  - pull_request
  - tag
  - promote
  - rollback

Example include syntax:

trigger:
  event:
    include:
    - push
    - pull_request

Example exclude syntax:

trigger:
  event:
    exclude:
    - pull_request

By Status

The status trigger can only be used in multi-pipeline configurations, where you need to limit the execution of a single pipeline based on the overall status. In the below example, the deployment pipeline will only execute if the build pipeline is successful.

---
kind: pipeline
name: build

steps:
- name: build
  image: golang
  commands:
  - go build
  - go test

---
kind: pipeline

steps:
- name: deployment
  image: ...

trigger:
  status:
  - success

depends_on:
- build

Execute a pipeline when the overall pipeline status is passing:

trigger:
  status:
  - success

Execute a pipeline when the overall pipeline status is failing:

trigger:
  status:
  - failure

Execute a pipeline when the overall pipeline status is passing or failing. This will ensure the pipeline is always executed.

trigger:
  status:
  - success
  - failure

On This Page:

Getting Help

Mailing List
Search for information in the mailing list archives, or post a question.
Chat Support
Real-time chat support from maintainers and community members.