Created
November 10, 2020 07:10
-
-
Save jayco/3524a02458e342c878dd64bf806d207c to your computer and use it in GitHub Desktop.
Multi environment/region test, build and deploy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
env: | |
DOCKER_IMAGE_TAG: "myservice-${BUILDKITE_BRANCH}-${BUILDKITE_COMMIT:0:7}" | |
steps: | |
- name: 'test :hammer:' | |
agents: | |
queue: aws-buildkite-agent | |
command: echo ".buildkite/test.sh" | |
- wait: | |
- env: | |
DOCKER_BUILD_NETWORK: myservice-build | |
name: 'Build & Push :docker:' | |
agents: | |
queue: aws-buildkite-agent | |
command: echo ".buildkite/builder.sh" | |
- wait: | |
- block: Start Test Database Migration | |
branches: "!master" | |
- env: | |
CONSUL_HOST: consul.us.test.dummy.com | |
name: ":postgres: schema migration - test environment us-east-1" | |
agents: | |
queue: aws-migrate-agent | |
region: us-east-1 | |
environment: test | |
command: echo "/etc/buildkite-agent/buildkite-scripts/migrate.sh" | |
- wait: | |
- block: Start test deployment | |
branches: "!master" | |
- trigger: deploy-test-us-east-1 | |
name: ":docker: Deploy myservice to test us-east-1" | |
build: | |
env: | |
DOCKER_IMAGE_TAG: $DOCKER_IMAGE_TAG | |
- wait: | |
- block: Start Production Database Migration | |
branches: master | |
- env: | |
CONSUL_HOST: consul.us.prod.dummy.com | |
name: ":postgres: schema migration - production us-east-1" | |
agents: | |
queue: aws-migrate-agent | |
region: us-east-1 | |
environment: production | |
command: echo "/etc/buildkite-agent/buildkite-scripts/migrate.sh" | |
branches: master | |
- env: | |
CONSUL_HOST: consul.syd.prod.dummy.com | |
name: ":postgres: schema migration - production ap-southeast-2" | |
agents: | |
queue: aws-migrate-agent | |
region: ap-southeast-2 | |
environment: production | |
command: echo "/etc/buildkite-agent/buildkite-scripts/migrate.sh" | |
branches: master | |
- env: | |
CONSUL_HOST: consul.dub.prod.dummy.com | |
name: ":postgres: schema migration for production eu-west-1" | |
agents: | |
queue: aws-migrate-agent | |
region: eu-west-1 | |
environment: production | |
command: echo "/etc/buildkite-agent/buildkite-scripts/migrate.sh" | |
branches: master | |
- wait: | |
- name: ":docker: Deploy myservice to Production ap-southeast-2" | |
build: | |
env: | |
DOCKER_IMAGE_TAG: $DOCKER_IMAGE_TAG | |
trigger: deploy-myservice-ap-southeast-2-production | |
branches: master | |
- wait: | |
- name: ":docker: Deploy myservice to Production eu-west-1" | |
build: | |
env: | |
DOCKER_IMAGE_TAG: $DOCKER_IMAGE_TAG | |
trigger: deploy-myservice-eu-west-1-production | |
branches: master | |
- wait: | |
- name: ":docker: Deploy myservice to Production us-east-1" | |
build: | |
env: | |
DOCKER_IMAGE_TAG: $DOCKER_IMAGE_TAG | |
trigger: deploy-myservice-us-east-1-production | |
branches: master |
Hi @jayco ,
Is this syntax still working, i.e.
agents:
queue: aws-migrate-agent
region: us-east-1
I have all steps using one region except for one step I want to use agent from another region. Is this still doable? Thanks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Concept
This pipeline serves as a conceptual example of steps to test, build, push and deploy across regions using a test and production environment.
Here is the break down of the steps:
Note: the use of agent queues and tags to target different agents across regions.
Video of the build - PR branch (not master, optional test deploys)
Video of the build - (master, optional prod deploys)