-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.gitlab-ci.yml
102 lines (92 loc) · 2.14 KB
/
.gitlab-ci.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
100
101
102
stages:
- build
- test
- docker
- helm
variables:
ECR_REPO: raphael.deem/hello-kubecon
ECR_HOST: <REDACTED>
HELM_CHART_REPOSITORY: <REDACTED>
APP_PORT: 80
.template: &docker_job
image: "docker:1.12"
tags:
- tm-prod cicd build
.template: &test_job
image: "golang:1.9"
tags:
- tm-nonprod cicd test
.template: &helm_job
image: "tmhub.io/kubernetes/helm:v2.3.1_cd"
variables:
KUBERNETES_NAMESPACE_OVERWRITE: prd354
KUBERNETES_SERVICE_ACCOUNT_OVERWRITE: tiller
environment:
name: dev
# combine build/push
docker:
stage: build
<<: *docker_job
script:
- docker build --pull -t $ECR_HOST/$ECR_REPO:$CI_BUILD_REF --build-arg APP_PORT=80 .
- docker push $ECR_HOST/$ECR_REPO:$CI_BUILD_REF
test:
image: "golang"
stage: test
<<: *test_job
script:
- go test
deploy-aws:
stage: helm
<<: *helm_job
tags:
- preprod1.us-east-1
- kubernetes
script:
- helm init -c
- helm repo add tm $HELM_CHART_REPOSITORY
- helm repo update
- helm upgrade --tiller-namespace=prd354 -i hello-kubecon tm/webservice -f values.yaml -f aws-values.yaml --namespace=prd354 --set image.tag=$CI_BUILD_REF --set httpPort=$APP_PORT --version=0.10.0
only:
- master
destroy-aws:
stage: helm
<<: *helm_job
tags:
- preprod1.us-east-1
- kubernetes
script:
- helm init -c
- helm --tiller-namespace=prd354 --namespace=prd354 delete --purge hello-kubecon
only:
- master
when: manual
allow_failure: true
deploy-onprem:
stage: helm
<<: *helm_job
tags:
- phx
- nonprod
- kubernetes
script:
- helm init -c
- helm repo add tm $HELM_CHART_REPOSITORY
- helm repo update
- helm upgrade --tiller-namespace=prd354 -i hello-kubecon tm/webservice -f values.yaml -f onprem-values.yaml --namespace=prd354 --set image.tag=$CI_BUILD_REF --set httpPort=$APP_PORT --version=0.10.0
only:
- master
destroy-onprem:
stage: helm
<<: *helm_job
tags:
- ash
- nonprod
- kubernetes
script:
- helm init -c
- helm --tiller-namespace=prd354 --namespace=prd354 delete --purge hello-kubecon
only:
- master
when: manual
allow_failure: true