forked from psono/psono-admin-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
273 lines (246 loc) · 11.1 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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
variables:
CONTAINER_TEST_IMAGE: psono-docker.jfrog.io/psono/psono-admin-client:$CI_BUILD_REF_NAME
CONTAINER_RELEASE_IMAGE: psono-docker.jfrog.io/psono/psono-admin-client:latest
stages:
- test
- build
- release
- deploy
test-unittests:
except:
- schedules
stage: test
image: psono-docker.jfrog.io/ubuntu:18.04
script:
- sh ./var/build-ubuntu.sh
- npm test -- --coverage
# - apt-get install -y --no-install-recommends xvfb x11vnc fluxbox xterm
# - curl -fsSL https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
# - echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list
# - apt-get update
# - apt-get install -y google-chrome-stable
# - karma start ./unittests/karma-chrome-headless.conf.js
test-vulnerability-scan:
except:
- schedules
stage: test
image: psono-docker.jfrog.io/node:lts-alpine
script:
- npm audit
allow_failure: true
#test-linter:
# except:
# - schedules
# stage: test
# image: psono-docker.jfrog.io/ubuntu:18.04
# script:
# - sh ./var/build-ubuntu.sh
# - cat ./build/firefox/manifest.json
# - addons-linter --help
# - addons-linter ./build/firefox
test-upload-translations:
stage: test
image: psono-docker.jfrog.io/python:3
script:
- pip install requests
- python3 var/sync_translations.py
only:
- develop
- saml
build-docker-image:
except:
- schedules
stage: build
image: psono-docker.jfrog.io/ubuntu:18.04
services:
- docker:18-dind
variables:
DOCKER_HOST: 'tcp://docker:2375'
script:
- sh ./var/download_translations_from_artifactory.sh
- sh ./var/build-ubuntu.sh
- curl -fSL "https://download.docker.com/linux/static/stable/x86_64/docker-17.12.1-ce.tgz" -o docker.tgz && echo "1270dce1bd7e1838d62ae21d2505d87f16efc1d9074645571daaefdfd0c14054 *docker.tgz" | sha256sum -c - && tar -xzvf docker.tgz && mv docker/* /usr/local/bin/ && rm -Rf docker*
- docker info
- echo $CI_BUILD_TOKEN | docker login --username=gitlab-ci-token --password-stdin registry.gitlab.com
- echo $artifactory_credentials | docker login --username=gitlab --password-stdin psono-docker.jfrog.io
- docker build -t $CONTAINER_TEST_IMAGE --pull .
- docker push $CONTAINER_TEST_IMAGE
- curl -fL https://getcli.jfrog.io | sh
- ./jfrog rt c rt-server-1 --url=https://psono.jfrog.io/psono --user=gitlab --password=$artifactory_credentials
- ./jfrog rt sp "docker/psono/psono-admin-client/$CI_BUILD_REF_NAME/manifest.json" "CI_BUILD_REF_NAME=$CI_BUILD_REF_NAME;CI_COMMIT_SHA=$CI_COMMIT_SHA;CI_COMMIT_URL=$CI_PROJECT_URL/commit/$CI_COMMIT_SHA;CI_PROJECT_ID=$CI_PROJECT_ID;CI_PROJECT_NAME=$CI_PROJECT_NAME;CI_PROJECT_NAMESPACE=$CI_PROJECT_NAMESPACE;CI_PROJECT_URL=$CI_PROJECT_URL;CI_PIPELINE_ID=$CI_PIPELINE_ID;CI_PIPELINE_URL=$CI_PROJECT_URL/pipelines/$CI_PIPELINE_ID;CI_COMMIT_REF_NAME=$CI_COMMIT_REF_NAME;CI_JOB_ID=$CI_JOB_ID;CI_JOB_URL=$CI_PROJECT_URL/-/jobs/$CI_JOB_ID;CI_JOB_NAME=$CI_JOB_NAME;CI_JOB_STAGE=$CI_JOB_STAGE;CI_RUNNER_ID=$CI_RUNNER_ID;GITLAB_USER_ID=$GITLAB_USER_ID;CI_SERVER_VERSION=$CI_SERVER_VERSION"
- ./jfrog rt sp "docker/psono/psono-admin-client/$CI_BUILD_REF_NAME/manifest.json" "CI_COMMIT_TAG=$CI_COMMIT_TAG" || true
#build-firefox-extension:
# except:
# - schedules
# stage: build
# image: psono-docker.jfrog.io/ubuntu:18.04
# script:
# - sh ./var/build-ubuntu.sh
# - sh ./var/package-firefox-extension.sh
# - curl -fL https://getcli.jfrog.io | sh
# - ./jfrog rt c rt-server-1 --url=https://psono.jfrog.io/psono --user=gitlab --password=$artifactory_credentials
# - ./jfrog rt u --props="CI_BUILD_REF_NAME=$CI_BUILD_REF_NAME;CI_COMMIT_SHA=$CI_COMMIT_SHA;CI_COMMIT_URL=$CI_PROJECT_URL/commit/$CI_COMMIT_SHA;CI_PROJECT_ID=$CI_PROJECT_ID;CI_PROJECT_NAME=$CI_PROJECT_NAME;CI_PROJECT_NAMESPACE=$CI_PROJECT_NAMESPACE;CI_PROJECT_URL=$CI_PROJECT_URL;CI_PIPELINE_ID=$CI_PIPELINE_ID;CI_PIPELINE_URL=$CI_PROJECT_URL/pipelines/$CI_PIPELINE_ID;CI_COMMIT_REF_NAME=$CI_COMMIT_REF_NAME;CI_JOB_ID=$CI_JOB_ID;CI_JOB_URL=$CI_PROJECT_URL/-/jobs/$CI_JOB_ID;CI_JOB_NAME=$CI_JOB_NAME;CI_JOB_STAGE=$CI_JOB_STAGE;CI_RUNNER_ID=$CI_RUNNER_ID;GITLAB_USER_ID=$GITLAB_USER_ID;CI_SERVER_VERSION=$CI_SERVER_VERSION" /builds/psono/psono-admin-client/dist/firefox/psono.firefox.PW.zip psono/admin-client/$CI_BUILD_REF_NAME/firefox-extension.zip
# - ./jfrog rt sp "psono/admin-client/$CI_BUILD_REF_NAME/firefox-extension.zip" "CI_COMMIT_TAG=$CI_COMMIT_TAG" || true
# - mv /builds/psono/psono-admin-client/build/firefox ../
# - rm -Rf *
# - rm -Rf .* 2> /dev/null || true
# - mv ../firefox/* ./
# artifacts:
# name: "firefox_$CI_BUILD_REF_NAME"
# paths:
# - ./*
#
#
#build-chrome-extension:
# except:
# - schedules
# stage: build
# image: psono-docker.jfrog.io/ubuntu:18.04
# script:
# - sh ./var/build-ubuntu.sh
# - sh ./var/package-chrome-extension.sh
# - curl -fL https://getcli.jfrog.io | sh
# - ./jfrog rt c rt-server-1 --url=https://psono.jfrog.io/psono --user=gitlab --password=$artifactory_credentials
# - ./jfrog rt u --props="CI_BUILD_REF_NAME=$CI_BUILD_REF_NAME;CI_COMMIT_SHA=$CI_COMMIT_SHA;CI_COMMIT_URL=$CI_PROJECT_URL/commit/$CI_COMMIT_SHA;CI_PROJECT_ID=$CI_PROJECT_ID;CI_PROJECT_NAME=$CI_PROJECT_NAME;CI_PROJECT_NAMESPACE=$CI_PROJECT_NAMESPACE;CI_PROJECT_URL=$CI_PROJECT_URL;CI_PIPELINE_ID=$CI_PIPELINE_ID;CI_PIPELINE_URL=$CI_PROJECT_URL/pipelines/$CI_PIPELINE_ID;CI_COMMIT_REF_NAME=$CI_COMMIT_REF_NAME;CI_JOB_ID=$CI_JOB_ID;CI_JOB_URL=$CI_PROJECT_URL/-/jobs/$CI_JOB_ID;CI_JOB_NAME=$CI_JOB_NAME;CI_JOB_STAGE=$CI_JOB_STAGE;CI_RUNNER_ID=$CI_RUNNER_ID;GITLAB_USER_ID=$GITLAB_USER_ID;CI_SERVER_VERSION=$CI_SERVER_VERSION" /builds/psono/psono-admin-client/dist/chrome/psono.chrome.PW.zip psono/admin-client/$CI_BUILD_REF_NAME/chrome-extension.zip
# - ./jfrog rt sp "psono/admin-client/$CI_BUILD_REF_NAME/chrome-extension.zip" "CI_COMMIT_TAG=$CI_COMMIT_TAG" || true
# - mv /builds/psono/psono-admin-client/build/chrome ../
# - rm -Rf *
# - rm -Rf .* 2> /dev/null || true
# - mv ../chrome/* ./
# artifacts:
# name: "chrome_$CI_BUILD_REF_NAME"
# paths:
# - ./*
build-webclient:
except:
- schedules
stage: build
image: psono-docker.jfrog.io/ubuntu:18.04
script:
- sh ./var/download_translations_from_artifactory.sh
- sh ./var/build-ubuntu.sh
- sh ./var/package-webclient.sh
- curl -fL https://getcli.jfrog.io | sh
- ./jfrog rt c rt-server-1 --url=https://psono.jfrog.io/psono --user=gitlab --password=$artifactory_credentials
- ./jfrog rt u --props="CI_BUILD_REF_NAME=$CI_BUILD_REF_NAME;CI_COMMIT_SHA=$CI_COMMIT_SHA;CI_COMMIT_URL=$CI_PROJECT_URL/commit/$CI_COMMIT_SHA;CI_PROJECT_ID=$CI_PROJECT_ID;CI_PROJECT_NAME=$CI_PROJECT_NAME;CI_PROJECT_NAMESPACE=$CI_PROJECT_NAMESPACE;CI_PROJECT_URL=$CI_PROJECT_URL;CI_PIPELINE_ID=$CI_PIPELINE_ID;CI_PIPELINE_URL=$CI_PROJECT_URL/pipelines/$CI_PIPELINE_ID;CI_COMMIT_REF_NAME=$CI_COMMIT_REF_NAME;CI_JOB_ID=$CI_JOB_ID;CI_JOB_URL=$CI_PROJECT_URL/-/jobs/$CI_JOB_ID;CI_JOB_NAME=$CI_JOB_NAME;CI_JOB_STAGE=$CI_JOB_STAGE;CI_RUNNER_ID=$CI_RUNNER_ID;GITLAB_USER_ID=$GITLAB_USER_ID;CI_SERVER_VERSION=$CI_SERVER_VERSION" /builds/psono/psono-admin-client/build/psono.webclient.zip psono/admin-client/$CI_BUILD_REF_NAME/webclient.zip
- ./jfrog rt sp "psono/admin-client/$CI_BUILD_REF_NAME/webclient.zip" "CI_COMMIT_TAG=$CI_COMMIT_TAG" || true
- mv /builds/psono/psono-admin-client/build ../
- rm -Rf *
- rm -Rf .* 2> /dev/null || true
- mv ../build/* ./
artifacts:
name: "webclient_$CI_BUILD_REF_NAME"
paths:
- ./*
release-artifacts:
except:
- schedules
stage: release
image: psono-docker.jfrog.io/ubuntu:18.04
script:
- apt-get update
- apt-get install -y curl
- curl -fL https://getcli.jfrog.io | sh
- ./jfrog rt c rt-server-1 --url=https://psono.jfrog.io/psono --user=gitlab --password=$artifactory_credentials
# - ./jfrog rt cp --flat psono/admin-client/$CI_BUILD_REF_NAME/firefox-extension.zip psono/admin-client/latest/
# - ./jfrog rt cp --flat psono/admin-client/$CI_BUILD_REF_NAME/chrome-extension.zip psono/admin-client/latest/
- ./jfrog rt cp --flat psono/admin-client/$CI_BUILD_REF_NAME/webclient.zip psono/admin-client/latest/
only:
- /^v[0-9]*\.[0-9]*\.[0-9]*$/
release-docker:
except:
- schedules
stage: release
image: psono-docker.jfrog.io/docker:19.03.8-git
services:
- docker:18-dind
script:
- docker info
- echo $CI_BUILD_TOKEN | docker login --username=gitlab-ci-token --password-stdin registry.gitlab.com
- echo $artifactory_credentials | docker login --username=gitlab --password-stdin psono-docker.jfrog.io
- docker pull $CONTAINER_TEST_IMAGE
- docker tag $CONTAINER_TEST_IMAGE $CONTAINER_RELEASE_IMAGE
- docker push $CONTAINER_RELEASE_IMAGE
only:
- /^v[0-9]*\.[0-9]*\.[0-9]*$/
#deploy-security-scan-image:
# except:
# - schedules
# stage: deploy
# image: psono-docker.jfrog.io/docker:19.03.8-git
# services:
# - docker:18-dind
# script:
# - docker info
# - echo $artifactory_credentials | docker login --username=gitlab --password-stdin psono-docker.jfrog.io
# - echo $docker_hub_credentials | docker login --username=psonogitlab --password-stdin
# - docker pull $CONTAINER_TEST_IMAGE
# - docker tag $CONTAINER_TEST_IMAGE psono/security-scans:psono-admin-client-ce-$CI_BUILD_REF_NAME
# - docker push psono/security-scans:psono-admin-client-ce-$CI_BUILD_REF_NAME
deploy-docker:
except:
- schedules
stage: deploy
image: psono-docker.jfrog.io/docker:19.03.8-git
services:
- docker:18-dind
script:
- echo $artifactory_credentials | docker login --username=gitlab --password-stdin psono-docker.jfrog.io
- echo $docker_hub_credentials | docker login --username=psonogitlab --password-stdin
- sh ./var/deploy-docker.sh
only:
- /^v[0-9]*\.[0-9]*\.[0-9]*$/
deploy-github:
except:
- schedules
stage: deploy
image: psono-docker.jfrog.io/docker:19.03.8-git
services:
- docker:18-dind
script:
- sh ./var/deploy-github.sh
environment:
name: github
url: https://github.com/psono/psono-admin-client
only:
- /^v[0-9]*\.[0-9]*\.[0-9]*$/
#deploy-chrome:
# except:
# - schedules
# stage: deploy
# image: psono-docker.jfrog.io/ubuntu:18.04
# script:
# - sh ./var/build-ubuntu.sh
# - sh ./var/deploy-chrome-extension.sh
# environment:
# name: chrome-webstore
# url: https://chrome.google.com/webstore/detail/psonopw/eljmjmgjkbmpmfljlmklcfineebidmlo
# only:
# - /^v[0-9]*\.[0-9]*\.[0-9]*$/
#
#
#deploy-firefox:
# except:
# - schedules
# stage: deploy
# image: psono-docker.jfrog.io/ubuntu:18.04
# script:
# - sh ./var/build-ubuntu.sh
# - sh ./var/deploy-firefox-extension.sh
# environment:
# name: firefox-webstore
# url: https://addons.mozilla.org/de/firefox/addon/psono-pw-password-manager/
# only:
# - /^v[0-9]*\.[0-9]*\.[0-9]*$/
deploy-changelog:
except:
- schedules
stage: deploy
image: psono-docker.jfrog.io/ubuntu:18.04
script:
- sh ./var/deploy_changelog.sh
environment:
name: static.psono.com
url: https://static.psono.com/gitlab.com/psono/psono-admin-client/changelog.json
only:
- /^v[0-9]*\.[0-9]*\.[0-9]*$/