Build trigger on push AND pr

I have a pipeline which should trigger only when a pull_request are opened or pull_request are updated.
Every time I push some change on this PR, drone triggers 2 builds: one which just clone and another one for the configured pull request.

Is there a way to tell drone to only build on the PR?

My .drone.yml config:

kind: pipeline
name: notifications


  • name: test
    image: ruby:2.3
    • apt-get update && apt-get install -y build-essential nodejs libpq-dev --fix-missing --no-install-recommends && apt-get clean
    • gem install bundler && bundle install
    • bundle exec rake db:create
    • bundle exec rake db:migrate
    • bundle exec rspec
      RAILS_ENV: test
      NOTIFICATION_DBHOST: postgres_service
      REDIS_PROVIDER: redis_service
      • pull_request


  • name: postgres_service
    image: postgres:9.4-alpine
    POSTGRES_USER: postgres
    POSTGRES_DB: noverde_cep_test
  • name: redis_service
    image: redis

Yes see the Triggers section in the Pipeline documentation.

@bradrydzewski That triggers on either pull request OR push. We would like to build only when pushing on branches that have a pull request. Background is that the drone pipeline is expensive (resource wise) and time consuming so it should not happen on every push.

when you push to a branch with an open pull request, it triggers a pull_request synchronization event. Therefore you can instruct Drone to only trigger pipelines for pull requests.

  - pull_request

@bradrydzewski Thanks for your quick response! I tried that today with BitBucket, push on open pull request does NOT trigger another build with Drone 1.7.0! It just revokes the “successful build” tag from the pull request…
Ideas are very welcome :wink:

are you running bitbucket server (self-hosted)? If yes, this is an issue with bitbucket server which, until recently, did not send synchronization events. Bitbucket server recently added support for this capability, but now we need to update code in Drone to support it, which has not happened yet.

Thanks for the information! Yes we are running an self-hosted BitBucket. Looking forward to that Drone feature!

yes, this is planned for a future release and is published on our trello roadmap:

1 Like