-
Notifications
You must be signed in to change notification settings - Fork 4
/
.gitlab-ci.yml
201 lines (183 loc) · 5.95 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
stages:
- test
# - build
# - release
# - deploy
test test:
stage: test
script:
- echo "Hello!"
# variables:
# CONTAINER_IMAGE: ${CI_REGISTRY}/${CI_PROJECT_PATH}
# NAMESPACE: hosting
# SECRET: gitlab-registry
# REPOSITORY: ${CI_REGISTRY}/${CI_PROJECT_PATH}
# RECAPTCHA_SAND: 6LejdSMUAAAAADNv4yBEqxz4TAyXEIYCbwphVSDS
# .docker-login: &docker-login
# before_script:
# - docker login -u gitlab-ci-token -p ${CI_BUILD_TOKEN} ${CI_REGISTRY}
# test lint:
# services:
# image: node:9.2.1
# stage: test
# tags:
# - build
# script:
# - npm install -g -s --no-progress yarn node-gyp
# - yarn
# - npm rebuild node-sass --force
# - yarn lint
# except:
# - develop
# - master
# - tags
# test-build-online:
# services:
# image: docker:latest
# stage: test
# tags:
# - build
# script:
# - docker build -t ${CONTAINER_IMAGE}:${CI_COMMIT_SHA:0:8} .
# - docker rmi --force ${CONTAINER_IMAGE}:${CI_COMMIT_SHA:0:8}
# except:
# - develop
# - master
# - staging
# - tags
# test-build-offline:
# services:
# image: docker:latest
# stage: test
# tags:
# - build
# script:
# - docker build -t ${CONTAINER_IMAGE}:${CI_COMMIT_SHA:0:8} --build-arg SOURCE_TYPE=OFLINE .
# - docker rmi --force ${CONTAINER_IMAGE}:${CI_COMMIT_SHA:0:8}
# except:
# - develop
# - master
# - staging
# - tags
# dev-release:
# image: docker:latest
# stage: release
# tags:
# - build
# <<: *docker-login
# script:
# - docker build -t ${CONTAINER_IMAGE}:${CI_COMMIT_SHA:0:8} .
# - docker push ${CONTAINER_IMAGE}:${CI_COMMIT_SHA:0:8}
# - docker rmi --force ${CONTAINER_IMAGE}:${CI_COMMIT_SHA:0:8}
# only:
# - develop
# dev-release-offline:
# image: docker:latest
# stage: release
# tags:
# - build
# <<: *docker-login
# script:
# - docker build -t ${CONTAINER_IMAGE}:${CI_COMMIT_SHA:0:8}-offline --build-arg SOURCE_TYPE=OFFLINE .
# - docker push ${CONTAINER_IMAGE}:${CI_COMMIT_SHA:0:8}-offline
# - docker rmi --force ${CONTAINER_IMAGE}:${CI_COMMIT_SHA:0:8}-offline
# only:
# - develop
# dev-deploy:
# image: exon/helm
# stage: deploy
# tags:
# - develop
# before_script:
# - mkdir -p /etc/deploy/
# - echo ${SANDBOX_KUBE_CONFIG} | base64 -d > ${KUBECONFIG}
# - helm init --client-only
# - helm repo update
# environment:
# name: develop
# script:
# - cd charts/ui
# - helm dep up
# - helm upgrade --install --debug --namespace=${NAMESPACE} ${CI_PROJECT_NAME} --set tags.db=false --set image.tag=${CI_COMMIT_SHA:0:8} --set image.secret=${SECRET} --set image.repository=${REPOSITORY} --set service.externalIP=192.168.88.210 --set env.global.SOURCE_TYPE=online --set env.global.API_PROTOCOL_TYPE=ssl --set env.local.RECAPTCHA=${RECAPTCHA_SAND} --set env.local.API_HOST=192.168.88.210 --values values.yaml .
# - helm upgrade --install --debug --namespace=${NAMESPACE} ${CI_PROJECT_NAME}-offline --set tags.db=false --set image.tag=${CI_COMMIT_SHA:0:8}-offline --set image.secret=${SECRET} --set image.repository=${REPOSITORY} --set service.externalIP=192.168.88.210 --set env.global.SOURCE_TYPE=OFFLINE --set env.global.API_PROTOCOL_TYPE=ssl --set env.local.RECAPTCHA=${RECAPTCHA_SAND} --set env.local.API_HOST=192.168.88.210 --set service.port=3002 --values values.yaml .
# only:
# - develop
# pub-github:
# image: alpine
# stage: release
# tags:
# - build
# before_script:
# - apk update
# - apk upgrade
# - apk add --no-cache bash git openssh
# - git config --global user.email "[email protected]"
# - git config --global user.name "Containerum Bot"
# - mkdir -p ~/.ssh
# - echo ${ID_RSA_GITHUB} | base64 -d > ~/.ssh/id_rsa
# - echo ${ID_RSA_PUB_GITHUB} | base64 -d > ~/.ssh/id_rsa.pub
# - chmod 600 ~/.ssh/id_rsa
# - chmod 600 ~/.ssh/id_rsa.pub
# - eval `ssh-agent -s`
# - ssh-add ~/.ssh/id_rsa
# - ssh-keyscan -H github.com >> ~/.ssh/known_hosts
# script:
# - git remote show
# - if [ $(git remote show | grep github) ]; then git remote rm github; fi
# - if [ $(git branch --list | grep pub) ]; then git branch -d pub; fi
# - git remote add github ${GITHUB_REMOTE}
# - git pull origin develop
# - git fetch github
# - git checkout origin/develop
# - git checkout -b pub
# - git push -u github pub:develop --force
# - git remote rm github
# only:
# - develop
# stage-release:
# image: docker:latest
# stage: release
# tags:
# - build
# <<: *docker-login
# script:
# - docker build -t ${CONTAINER_IMAGE}:${CI_COMMIT_SHA:0:8} .
# - docker push ${CONTAINER_IMAGE}:${CI_COMMIT_SHA:0:8}
# - docker rmi --force ${CONTAINER_IMAGE}:${CI_COMMIT_SHA:0:8}
# only:
# - master
# prod-release:
# image: docker:latest
# stage: release
# tags:
# - build
# <<: *docker-login
# script:
# - docker pull ${CONTAINER_IMAGE}:${CI_COMMIT_SHA:0:8}
# - docker tag ${CONTAINER_IMAGE}:${CI_COMMIT_SHA:0:8} ${CONTAINER_IMAGE}:latest
# - docker tag ${CONTAINER_IMAGE}:${CI_COMMIT_SHA:0:8} ${CONTAINER_IMAGE}:${CI_COMMIT_TAG}
# - docker push ${CONTAINER_IMAGE}:latest
# - docker push ${CONTAINER_IMAGE}:${CI_COMMIT_TAG}
# - docker rmi --force ${CONTAINER_IMAGE}:${CI_COMMIT_SHA:0:8}
# only:
# - tags
# prod-deploy:
# image: exon/helm
# stage: deploy
# tags:
# - production
# before_script:
# - mkdir -p /etc/deploy/
# - echo ${PRODUCTION_KUBE_CONFIG_2} | base64 -d > ${KUBECONFIG}
# - helm init --client-only
# - helm repo update
# environment:
# name: production
# url: https://web.containerum.io
# script:
# - cd charts/ui
# - helm dep up
# - helm upgrade --install --namespace=${NAMESPACE} ${CI_PROJECT_NAME} --set tags.db=false --set image.tag=${CI_COMMIT_TAG} --set image.secret=${SECRET} --set image.repository=${REPOSITORY} --set service.externalIP=${PRODUCTION_IP} --values values.yaml .
# only:
# - tags
# when: manual