/
wercker.yml
99 lines (85 loc) · 2.67 KB
/
wercker.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
box: node
# Developer
dev:
steps:
- script:
name: yarn
code: |
export REACT_APP_API_ENDPOINT=$TIME_API_ENDPOINT
yarn start
# Build Application
build:
services:
- id: wcr.io/${WERCKER_APPLICATION_OWNER_NAME}/time-api:master
steps:
- script:
name: Install Dependencies
code: |
npm install
- script:
name: build
code: |
export REACT_APP_API_ENDPOINT=$TIME_API_ENDPOINT
yarn build
# Curl should return a falsey exit code if the API endpoint isn't up.
- script:
name: Test API endpoint
code: |
local_api_endpoint="http://${TIME_API_PORT_8080_TCP_ADDR}:${TIME_API_PORT_8080_TCP_PORT}/time"
curl --silent $local_api_endpoint
echo $?
- script:
name: move output
code: |
mv *.template $WERCKER_OUTPUT_DIR/
mv build $WERCKER_OUTPUT_DIR
# Push Docker Image
push-image:
steps:
- script:
name: Set up serve
code: |
yarn global add serve
- internal/docker-push:
cmd: serve -s /pipeline/source/build -p 8000
tag: $WERCKER_GIT_COMMIT
ports: "8000"
# Deploy to a Kubernetes cluster
deploy-to-kubernetes:
# We only need a minimal shell environment to run Kubectl.
box:
id: alpine
cmd: /bin/sh
steps:
# https://github.com/wercker/step-bash-template
# This Wercker step will look for files in our repo with a .template extension.
# It will expand any environment variables in those files, then remove the
# template extension.
- bash-template
# The step above should leave us with a Kubernetes service and deployment yml files.
# We'll create a directory to move them to.
- script:
name: Prepare Kubernetes files
code: |
ls -lth
cat kubernetes_*.yml
mkdir $WERCKER_OUTPUT_DIR/kubernetes
mv kubernetes_*.yml $WERCKER_OUTPUT_DIR/kubernetes
- kubectl:
name: deploy to kubernetes
server: $KUBERNETES_MASTER
token: $KUBERNETES_TOKEN
insecure-skip-tls-verify: true
command: apply -f $WERCKER_OUTPUT_DIR/kubernetes/
- kubectl:
name: set deployment timeout
server: $KUBERNETES_MASTER
token: $KUBERNETES_TOKEN
insecure-skip-tls-verify: true
command: patch deployment/time-web -p '{"spec":{"progressDeadlineSeconds":60}}'
- kubectl:
name: check deployment status
server: $KUBERNETES_MASTER
token: $KUBERNETES_TOKEN
insecure-skip-tls-verify: true
command: rollout status deployment/time-web