Let’s suppose I am building docker containers with multiple triggers, i.e.
master& version tags, e.g.
For master & version tags, obviously,
auto_tag: true is the best fit. Currently, for
development I have created separate pipelines:
--- kind: pipeline type: docker name: foo-version-master ... settings: ... auto_tag: true trigger: ref: - refs/heads/master - refs/tags/v* --- kind: pipeline type: docker name: foo-release ... settings: ... tags: - latest - latest-release trigger: ref: - refs/heads/release/* --- kind: pipeline type: docker name: foo-development ... settings: ... tags: - latest trigger: ref: - refs/heads/development
Although, of course, this works like intended it is a lot of “boilerplate” code.
drone.yml becomes quite long with a lot of code duplication.
What would be the best practice to achieve this behavior?
Ideally, I would think of either chaining config files, like only defining the pipeline names and triggers in
drone.yml and and the actual
foo.yml (since they are exactly the same for each build, they just differ in triggers and corresponding tags).
Or, alternatively, something in the direction of mapping triggers and tags to use:
trigger: ref_and_tag: refs/heads/development: - latest refs/heads/release/*: - latest - latest-release refs/heads/master: - auto_tag refs/tags/v*: - auto_tag
This functionality would be super handy and significantly reduce the lines of code in
drone.yml while, at the same time, drastically improving readability.