-
Notifications
You must be signed in to change notification settings - Fork 6
/
buildspec.yml
30 lines (29 loc) · 1.3 KB
/
buildspec.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
30
version: 0.2
phases:
install:
commands:
- ". ci/install_deps.sh"
pre_build:
commands:
- export COMMIT_SHA=$CODEBUILD_RESOLVED_SOURCE_VERSION
- export REV=$COMMIT_SHA
- export CODEBUILD_WEBHOOK_TRIGGER=${CODEBUILD_WEBHOOK_TRIGGER:-branch/master}
- export DEPLOY_ENV=$(echo $CODEBUILD_WEBHOOK_TRIGGER | sed -e 's/tag\/.*-\(.*\)/\1/' | sed -e 's/branch\/master/dev/')
- export PR=$(if case $CODEBUILD_WEBHOOK_TRIGGER in pr/*) ;; *) false;; esac; then echo 1; fi)
- export MASTER=$(if [ "$CODEBUILD_WEBHOOK_TRIGGER" = "branch/master" ]; then echo 1; fi)
- export CLUSTER=$(if [ "$DEPLOY_ENV" = "dev" ]; then echo "kubernetes-stage-us-west-2"; else echo "kubernetes-prod-us-west-2"; fi)
- echo "running for ${COMMIT_SHA} in ${DEPLOY_ENV}"
- aws eks update-kubeconfig --name $CLUSTER
- aws ecr get-login --region us-west-2 --no-include-email | bash
- echo $DOCKERHUB_PASSWORD | docker login -u $DOCKERHUB_USERNAME --password-stdin
build:
commands:
- if [ "$PR" = 1 ]; then ./do.sh package_local; fi
- if [ "$MASTER" = 1 ]; then ./do.sh package_local && ./do.sh push_image; fi
post_build:
commands:
- echo "Environment is ${DEPLOY_ENV}"
- if [ "$PR" = "" ]; then ./do.sh deploy; fi
cache:
paths:
- $HOME/.cargo