Trigger map v2 - restructuring

From @viktorbenei on Fri Oct 14 2016 06:20:38 GMT-0400 (EDT)

Instead of the current flat list:

trigger_map:
- push_branch: master
  workflow: wf1
- tag: v*.*.*
  workflow: wf2

Use a structured one:

triggers:
  pushes:
  - branch: master
    workflow: wf1
  tags:
  - tag: v*.*.*
    workflow: wf2

These events can’t happen at the same time; a single trigger event can’t be a code push and a pull request or tag at the same time, so there’s no need to specify priority between separate trigger types.

You can of course structure your trigger map like this today (first specify push trigger entries, then pull request, then tags), but it’s also quite easy to make it hard to understand if you don’t group it yourself.

An example of a confusingly structured trigger_map:

trigger_map:
- push_branch: master
  workflow: wf-master
- pull_request_target_branch: master
  workflow: wf-pr-to-master
- tag: v*.*.*
  workflow: wf-version-tag
- push_branch: develop
  workflow: wf-develop
- pull_request_target_branch: *
  workflow: wf-pr-wildcard

with the new syntax it would look like:

triggers:
  push:
  - branch: master
    workflow: wf-master
  - branch: develop
    workflow: wf-develop
  pull_requests:
  - target_branch: master
    workflow: wf-pr-to-master
  - target_branch: "*"
    workflow: wf-pr-wildcard
  tags:
  - tag: v*.*.*
    workflow: wf-version-tag

which makes it way easier to see the patterns for a specific trigger type (e.g. to check what happens at a code push)


Copied from original issue: https://github.com/bitrise-io/bitrise.io/issues/78

It’s been in production for a long time now, forgot to close it - closing it now :wink: