-
Notifications
You must be signed in to change notification settings - Fork 3
/
k8-buildspec.yml
29 lines (29 loc) · 1.05 KB
/
k8-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
---
version: 0.2
phases:
install:
commands:
- kubectl version --short --client
pre_build:
commands:
- TAG="$CODEBUILD_BUILD_NUMBER.$(date +%Y-%m-%d.%H.%M.%S).$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | head -c 8)"
- echo $TAG
- echo "${CODEBUILD_WEBHOOK_HEAD_REF}"
- echo "${BRANCH}"
- $(aws ecr get-login --no-include-email)
- export KUBECONFIG=$HOME/.kube/config
build:
commands:
- mvn clean install -Dmaven.test.skip=true
- |
if expr "${BRANCH}" : ".*master" >/dev/null || expr "${BRANCH}" : ".*dev" >/dev/null; then
docker build --tag $REPOSITORY_URI:$TAG .
fi
post_build:
commands:
- |
if expr "${BRANCH}" : ".*master" >/dev/null || expr "${BRANCH}" : ".*dev" >/dev/null; then
docker push $REPOSITORY_URI:$TAG
aws eks update-kubeconfig --name $EKS_CLUSTER_NAME --region us-east-1 --role-arn $EKS_KUBECTL_ROLE_ARN
kubectl set image cronjob/reciter-connect reciter-connect=$REPOSITORY_URI:$TAG -n vivo
fi