1

Trying to set up a conditional build in the drone.yml, here how it looks:

feature-dev-deployment:
when:
  event: push
  branches:
    include: feature/*
    exclude: master

The above code triggers for every build irrespective of branch name and also for master.

I want to trigger the build on branches only if it has the prefix 'feature' (like: 'feature/test/abc-123/desc') and it should not trigger the build for other patterns and master. As per the drone 0.5 documentation limit steps by branch, I assume i'm following right syntax.

2 Answers2

1

You mispelled it is branch and not branches

jhernandez
  • 847
  • 5
  • 9
1

The when clause is used to limit individual step execution. If you want to limit execution of the entire build process (all steps) by branch, you would use the following syntax:

pipeline:
  some_step:
    image: some/image
    commands:
      - echo foo

branches: [ feature/* ]

Note that in the above example we use the branches attribute, which is a top level attribute in the yaml file.

If you want to ignore certain event types (i.e. ignore pull requests, tags, etc.) you can enable or disable these events in your repository settings in the drone user interface.

Brad Rydzewski
  • 2,523
  • 14
  • 18