-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
147 lines (137 loc) · 3.39 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
include:
- project: "common/gitlab-ci"
ref: master
file: "/templates/cloudbuild-common.gitlab-ci.yaml"
- project: "common/gitlab-ci"
ref: master
file: "templates/deploy.gitlab-ci.yaml"
variables:
IMAGE_BASE: gcr.io/broxus/ton/tonswap/tonswap
CLUSTER_SETUP_DEV: gcloud container clusters get-credentials broxus-1 --zone europe-west1-c --project dexpa-175115
CLUSTER_SETUP_MASTER: gcloud container clusters get-credentials broxus-1 --zone europe-west1-c --project broxus
stages:
- cloudbuild
- deploy-config
- deploy-rollout
# dev pipeline
cloudbuild:image-dev:
extends: .cloudbuild:common
variables:
IMAGE_NAME: $IMAGE_BASE
only:
- develop
except:
- tags
script:
- gcloud builds submit --machine-type=n1-highcpu-8 --config=cloudbuild.yaml .
deploy:config-dev:
extends: .deploy:configuration
variables:
CONFIG_APPLICATION_PORT: "80"
CONFIG_HEALTHZ_PORT: "80"
CONFIG_HEALTHZ_URL: "/"
CONFIG_EXPOSE_PORT: "30170"
CONFIG_IMAGE: $IMAGE_BASE:$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA
only:
- develop
except:
- tags
script:
- |
deploy/common/build.sh kustomize \
-t statefulset \
-r deploy/common/base/service-statefulset.yaml \
-r deploy/common/base/service-expose.yaml \
-p kustomize/overrides.dev.yaml \
> kustomization.yaml
artifacts:
name: $CI_COMMIT_REF_NAME-deploy-config
paths:
- deploy/deployment.yaml
deploy:rollout-dev:
extends: .deploy:rollout
variables:
CLUSTER_SETUP: $CLUSTER_SETUP_DEV
CONFIG_APPLICATION: $CI_PROJECT_NAME
only:
- develop
except:
- tags
dependencies:
- deploy:config-dev
environment:
name: $CI_PROJECT_NAME-dev
on_stop: deploy:stop-dev
deploy:stop-dev:
extends: .deploy:stop
variables:
CLUSTER_SETUP: $CLUSTER_SETUP_DEV
CONFIG_APPLICATION: $CI_PROJECT_NAME
only:
- develop
except:
- tags
environment:
name: $CI_PROJECT_NAME-dev
action: stop
# master pipeline
cloudbuild:image-master:
extends: .cloudbuild:common
variables:
IMAGE_NAME: $IMAGE_BASE
only:
- master
except:
- tags
script:
- gcloud builds submit --machine-type=n1-highcpu-8 --config=cloudbuild.yaml .
deploy:config-master:
extends: .deploy:configuration
variables:
CONFIG_APPLICATION_PORT: "80"
CONFIG_HEALTHZ_PORT: "80"
CONFIG_HEALTHZ_URL: "/"
CONFIG_EXPOSE_PORT: "30170"
CONFIG_IMAGE: $IMAGE_BASE:$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA
only:
- master
except:
- tags
script:
- |
deploy/common/build.sh kustomize \
-t statefulset \
-r deploy/common/base/service-statefulset.yaml \
-r deploy/common/base/service-expose.yaml \
-p kustomize/overrides.master.yaml \
> kustomization.yaml
artifacts:
name: $CI_COMMIT_REF_NAME-deploy-config-master
paths:
- deploy/deployment.yaml
deploy:rollout-master:
extends: .deploy:rollout
variables:
CLUSTER_SETUP: $CLUSTER_SETUP_MASTER
CONFIG_APPLICATION: $CI_PROJECT_NAME
only:
- master
except:
- tags
dependencies:
- deploy:config-master
environment:
name: $CI_PROJECT_NAME-master
on_stop: deploy:stop-master
deploy:stop-master:
extends: .deploy:stop
variables:
CLUSTER_SETUP: $CLUSTER_SETUP_MASTER
CONFIG_APPLICATION: $CI_PROJECT_NAME
only:
- master
except:
- tags
environment:
name: $CI_PROJECT_NAME-master
action: stop