-
Notifications
You must be signed in to change notification settings - Fork 35
/
wercker.yml
97 lines (88 loc) · 3.3 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
build:
box: google/golang
steps:
# Test the project
- script:
name: go test
code: |
go test ./...
# Build the project
- script:
name: go build
code: |
go build -o app ./...
# Copy binary to location that gets passed along to deploy
- script:
name: copy binary
code: cp app cities-service.json cities-blue-controller.json cities-green-controller.json download-kube.sh $WERCKER_OUTPUT_DIR
deploy:
box: phusion/baseimage
steps:
- script:
name: make exec
code: chmod +x /pipeline/source/app
- internal/docker-push:
username: $USERNAME
password: $PASSWORD
cmd: ./pipeline/source/app
tag: latest
ports: "5000"
repository: quay.io/wercker/go-app
registry: https://quay.io
# Run this to create the rc and service
initialize:
- script:
name: fetch kube
code: ./download-kube.sh
- script:
name: create rc
code: |
kubernetes/platforms/linux/amd64/kubectl \
--server="${KUBERNETES_MASTER}" \
--username="${KUBERNETES_USERNAME}" \
--password="${KUBERNETES_PASSWORD}" \
--insecure-skip-tls-verify="true" \
create -f cities-green-controller.json
- script:
name: create service
code: |
kubernetes/platforms/linux/amd64/kubectl \
--server="${KUBERNETES_MASTER}" \
--username="${KUBERNETES_USERNAME}" \
--password="${KUBERNETES_PASSWORD}" \
--insecure-skip-tls-verify="true" \
create -f cities-service.json
rolling-update:
- script:
name: fetch kube
code: ./download-kube.sh
- script:
name: rolling update
code: |
info "Retrieving running rc"
if kubernetes/platforms/linux/amd64/kubectl \
--server="${KUBERNETES_MASTER}" \
--username="${KUBERNETES_USERNAME}" \
--password="${KUBERNETES_PASSWORD}" \
--insecure-skip-tls-verify="true" \
get rc cities-green > /dev/null 2> /dev/null; then
info "Currently running rc: cities-green"
info "Starting rolling-update"
kubernetes/platforms/linux/amd64/kubectl \
--server="${KUBERNETES_MASTER}" \
--username="${KUBERNETES_USERNAME}" \
--password="${KUBERNETES_PASSWORD}" \
--insecure-skip-tls-verify="true" \
rolling-update cities-green --update-period=10s -f cities-blue-controller.json
info "Finished update"
else
info "Currently running rc: cities-blue"
info "Starting rolling-update"
kubernetes/platforms/linux/amd64/kubectl \
--server="${KUBERNETES_MASTER}" \
--username="${KUBERNETES_USERNAME}" \
--password="${KUBERNETES_PASSWORD}" \
--insecure-skip-tls-verify="true" \
rolling-update cities-blue --update-period=10s -f cities-green-controller.json
info "Finished update"
fi