I’m still new to drone and figuring out how best what I want to do. Right now I have drone building and deploying to a static ecs service. What I’d like to do is have a a way to deploy somewhere different either automated or fairly manual. For example let’s say I have dev1, dev2, dev3, dev4 ecs services, I’d like to be able to deploy on demand or some other way different branches to those.
My initial thoughts are to add multiple promotion triggers, but seems like a waste to have to have to repeat the ecs section many times.
My initial thoughts are to add multiple promotion triggers
You can create multiple pipelines and use thetrigger
stanza to limit pipeline execution by promotion environment.
kind: pipeline
type: docker
name: production
steps: ...
trigger:
event:
- promote
environment:
- production
---
kind: pipeline
type: docker
name: staging
steps: ...
trigger:
event:
- promote
environment:
- staging
...
Or you could create one pipeline, and use the when
stanza to limit pipeline steps to specific promotion environments.
---
kind: pipeline
type: docker
name: default
steps:
- name: staging
when:
environment:
- staging
- name: production
when:
environment:
- production
...
but seems like a waste to have to have to repeat the ecs section many times.
If you want to reduce boilerplate within a single yaml document, you can use anchors: https://medium.com/@kinghuang/docker-compose-anchors-aliases-extensions-a1e4105d70bd
Or you can enable and use Jsonnet to reduce boilerplate:
https://docs.drone.io/pipeline/scripting/jsonnet/
1 Like
Many thanks for the info! I ended up converting everything to jsonnet and it works splendidly! Minus a few times I bashed my head with syntax errors.