-
Notifications
You must be signed in to change notification settings - Fork 32
/
buildspec-preview.yml
29 lines (28 loc) · 1.13 KB
/
buildspec-preview.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
version: 0.2
phases:
install:
runtime-versions:
docker: 18
nodejs: 12
commands:
- '. ci/install_deps.sh'
pre_build:
commands:
- export COMMIT_SHA=$CODEBUILD_RESOLVED_SOURCE_VERSION
- export CODEBUILD_WEBHOOK_TRIGGER=${CODEBUILD_WEBHOOK_TRIGGER:-branch/preview}
- export PREVIEW=$(if [ "$CODEBUILD_WEBHOOK_TRIGGER" = "branch/preview" ]; then echo 1; fi)
- echo "running for ${COMMIT_SHA} in dev and test"
- aws ecr get-login --region us-west-2 --no-include-email | bash
build:
commands:
- if [ "$PREVIEW" = 1 ]; then myke docker --baseurl=/preview --name=dino-park-front-end-preview --rev=$COMMIT_SHA push-image --name=dino-park-front-end-preview --rev=$COMMIT_SHA; fi
post_build:
commands:
- |
if [ "$PREVIEW" = 1 ]; then
echo "Deploying to dev and test envirnoments..."
aws eks update-kubeconfig --name kubernetes-stage-us-west-2
myke deploy-preview --deploy_env=dev --rev=$COMMIT_SHA
aws eks update-kubeconfig --name kubernetes-prod-us-west-2
myke deploy-preview --deploy_env=test --rev=$COMMIT_SHA
fi