.gitlab-ci.yml 10.6 KB
Newer Older
1
variables:
2 3
  CONTAINER_TEST_IMAGE: psono-docker.jfrog.io/psono/psono-client:$CI_BUILD_REF_NAME
  CONTAINER_RELEASE_IMAGE: psono-docker.jfrog.io/psono/psono-client:latest
4 5 6 7 8 9 10

stages:
  - test
  - build
  - release
  - deploy

11
test-unittests:
chickahoona's avatar
chickahoona committed
12 13
  except:
    - schedules
14
  stage: test
15
  image: psono-docker.jfrog.io/ubuntu:16.04
16 17
  script:
    - sh ./var/build-ubuntu.sh
Sascha Pfeiffer's avatar
Sascha Pfeiffer committed
18 19 20 21 22 23
    - apt-get install -y --no-install-recommends xvfb x11vnc fluxbox xterm chromium-browser
#    - 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-chromium-headless.conf.js
24

25
test-linter:
chickahoona's avatar
chickahoona committed
26 27
  except:
    - schedules
28
  stage: test
29
  image: psono-docker.jfrog.io/ubuntu:16.04
30 31
  script:
    - sh ./var/build-ubuntu.sh
32
    - cat ./build/firefox/manifest.json
chickahoona's avatar
chickahoona committed
33
    - addons-linter --help
34
    - addons-linter ./build/firefox
35 36


37
test-upload-translations:
38
  stage: test
39 40 41 42 43 44
  image: psono-docker.jfrog.io/python:3
  script:
    - pip install requests
    - python3 var/sync_translations.py
  only:
    - develop
45 46


47
build-docker-image:
chickahoona's avatar
chickahoona committed
48 49
  except:
    - schedules
50
  stage: build
51
  image: psono-docker.jfrog.io/ubuntu:16.04
52
  services:
Sascha Pfeiffer's avatar
Sascha Pfeiffer committed
53
    - docker:18-dind
54 55 56
  variables:
    DOCKER_HOST: 'tcp://docker:2375'
  script:
57
    - sh ./var/download_translations_from_artifactory.sh
58
    - sh ./var/build-ubuntu.sh
59
    - 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*
chickahoona's avatar
chickahoona committed
60
    - docker info
Sascha Pfeiffer's avatar
Sascha Pfeiffer committed
61
    - echo $artifactory_credentials | docker login --username=gitlab --password-stdin psono-docker.jfrog.io
62
    - docker build -t $CONTAINER_TEST_IMAGE --pull .
chickahoona's avatar
chickahoona committed
63
    - docker push $CONTAINER_TEST_IMAGE
64 65
    - curl -fL https://getcli.jfrog.io | sh
    - ./jfrog rt c rt-server-1 --url=https://psono.jfrog.io/psono --user=gitlab --password=$artifactory_credentials
Sascha Pfeiffer's avatar
Sascha Pfeiffer committed
66 67
    - ./jfrog rt sp "docker/psono/psono-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-client/$CI_BUILD_REF_NAME/manifest.json" "CI_COMMIT_TAG=$CI_COMMIT_TAG" || true
68

69

Sascha Pfeiffer's avatar
Sascha Pfeiffer committed
70

71
build-firefox-extension:
chickahoona's avatar
chickahoona committed
72 73
  except:
    - schedules
74
  stage: build
75
  image: psono-docker.jfrog.io/ubuntu:16.04
76
  script:
77
    - sh ./var/download_translations_from_artifactory.sh
chickahoona's avatar
chickahoona committed
78
    - sh ./var/build-ubuntu.sh
79
    - sh ./var/package-firefox-extension.sh
80 81
    - curl -fL https://getcli.jfrog.io | sh
    - ./jfrog rt c rt-server-1 --url=https://psono.jfrog.io/psono --user=gitlab --password=$artifactory_credentials
82
    - ./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-client/dist/firefox/psono.firefox.PW.zip psono/client/$CI_BUILD_REF_NAME/firefox-extension.zip
Sascha Pfeiffer's avatar
Sascha Pfeiffer committed
83
    - ./jfrog rt sp "psono/client/$CI_BUILD_REF_NAME/firefox-extension.zip" "CI_COMMIT_TAG=$CI_COMMIT_TAG" || true
84 85
    - mv /builds/psono/psono-client/build/firefox ../
    - rm -Rf *
86
    - rm -Rf .* 2> /dev/null || true
87 88 89 90
    - mv ../firefox/* ./
  artifacts:
    name: "firefox_$CI_BUILD_REF_NAME"
    paths:
chickahoona's avatar
chickahoona committed
91
    - ./*
92

Sascha Pfeiffer's avatar
Sascha Pfeiffer committed
93

94
build-chrome-extension:
chickahoona's avatar
chickahoona committed
95 96
  except:
    - schedules
97
  stage: build
98
  image: psono-docker.jfrog.io/ubuntu:16.04
99
  script:
100
    - sh ./var/download_translations_from_artifactory.sh
chickahoona's avatar
chickahoona committed
101
    - sh ./var/build-ubuntu.sh
102
    - sh ./var/package-chrome-extension.sh
103 104
    - curl -fL https://getcli.jfrog.io | sh
    - ./jfrog rt c rt-server-1 --url=https://psono.jfrog.io/psono --user=gitlab --password=$artifactory_credentials
105
    - ./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-client/dist/chrome/psono.chrome.PW.zip psono/client/$CI_BUILD_REF_NAME/chrome-extension.zip
Sascha Pfeiffer's avatar
Sascha Pfeiffer committed
106
    - ./jfrog rt sp "psono/client/$CI_BUILD_REF_NAME/chrome-extension.zip" "CI_COMMIT_TAG=$CI_COMMIT_TAG" || true
107 108
    - mv /builds/psono/psono-client/build/chrome ../
    - rm -Rf *
109
    - rm -Rf .* 2> /dev/null || true
110 111 112 113
    - mv ../chrome/* ./
  artifacts:
    name: "chrome_$CI_BUILD_REF_NAME"
    paths:
chickahoona's avatar
chickahoona committed
114
    - ./*
115

Sascha Pfeiffer's avatar
Sascha Pfeiffer committed
116

117
build-webclient:
chickahoona's avatar
chickahoona committed
118 119
  except:
    - schedules
120
  stage: build
121
  image: psono-docker.jfrog.io/ubuntu:16.04
122
  script:
123
    - sh ./var/download_translations_from_artifactory.sh
124
    - sh ./var/build-ubuntu.sh
125
    - sh ./var/package-webclient.sh
126 127
    - curl -fL https://getcli.jfrog.io | sh
    - ./jfrog rt c rt-server-1 --url=https://psono.jfrog.io/psono --user=gitlab --password=$artifactory_credentials
128
    - ./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-client/dist/webclient/psono.webclient.PW.zip psono/client/$CI_BUILD_REF_NAME/webclient.zip
Sascha Pfeiffer's avatar
Sascha Pfeiffer committed
129
    - ./jfrog rt sp "psono/client/$CI_BUILD_REF_NAME/webclient.zip" "CI_COMMIT_TAG=$CI_COMMIT_TAG" || true
130 131 132 133 134 135 136 137 138
    - mv /builds/psono/psono-client/build/webclient ../
    - rm -Rf *
    - rm -Rf .* 2> /dev/null || true
    - mv ../webclient/* ./
  artifacts:
    name: "webclient_$CI_BUILD_REF_NAME"
    paths:
    - ./*

Sascha Pfeiffer's avatar
Sascha Pfeiffer committed
139

140 141 142 143 144 145 146 147
release-artifacts:
  except:
    - schedules
  stage: release
  image: psono-docker.jfrog.io/ubuntu:16.04
  script:
    - apt-get update
    - apt-get install -y curl
148 149
    - curl -fL https://getcli.jfrog.io | sh
    - ./jfrog rt c rt-server-1 --url=https://psono.jfrog.io/psono --user=gitlab --password=$artifactory_credentials
Sascha Pfeiffer's avatar
Sascha Pfeiffer committed
150 151 152
    - ./jfrog rt cp --flat psono/client/$CI_BUILD_REF_NAME/firefox-extension.zip psono/client/latest/
    - ./jfrog rt cp --flat psono/client/$CI_BUILD_REF_NAME/chrome-extension.zip psono/client/latest/
    - ./jfrog rt cp --flat psono/client/$CI_BUILD_REF_NAME/webclient.zip psono/client/latest/
153 154 155 156
  only:
    - /^v[0-9]*\.[0-9]*\.[0-9]*$/


157
release-docker:
chickahoona's avatar
chickahoona committed
158 159
  except:
    - schedules
160
  stage: release
161
  image: psono-docker.jfrog.io/docker:git
162
  services:
Sascha Pfeiffer's avatar
Sascha Pfeiffer committed
163
    - docker:18-dind
164
  script:
chickahoona's avatar
chickahoona committed
165
    - docker info
Sascha Pfeiffer's avatar
Sascha Pfeiffer committed
166
    - echo $artifactory_credentials | docker login --username=gitlab --password-stdin psono-docker.jfrog.io
chickahoona's avatar
chickahoona committed
167 168 169
    - docker pull $CONTAINER_TEST_IMAGE
    - docker tag $CONTAINER_TEST_IMAGE $CONTAINER_RELEASE_IMAGE
    - docker push $CONTAINER_RELEASE_IMAGE
170
  only:
171
    - /^v[0-9]*\.[0-9]*\.[0-9]*$/
172

Sascha Pfeiffer's avatar
Sascha Pfeiffer committed
173

174 175 176 177 178 179
#deploy-security-scan-image:
#  except:
#    - schedules
#  stage: deploy
#  image: psono-docker.jfrog.io/docker:git
#  services:
Sascha Pfeiffer's avatar
Sascha Pfeiffer committed
180
#    - docker:18-dind
181 182 183 184 185 186 187
#  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-client-ce-$CI_BUILD_REF_NAME
#    - docker push psono/security-scans:psono-client-ce-$CI_BUILD_REF_NAME
188 189


190
deploy-docker:
chickahoona's avatar
chickahoona committed
191 192
  except:
    - schedules
193
  stage: deploy
194
  image: psono-docker.jfrog.io/docker:git
195
  services:
Sascha Pfeiffer's avatar
Sascha Pfeiffer committed
196
    - docker:18-dind
197
  script:
198
    - echo $artifactory_credentials | docker login --username=gitlab --password-stdin psono-docker.jfrog.io
Sascha Pfeiffer's avatar
Sascha Pfeiffer committed
199
    - echo $docker_hub_credentials | docker login --username=psonogitlab --password-stdin
200
    - sh ./var/deploy-docker.sh
chickahoona's avatar
chickahoona committed
201 202 203
  environment:
    name: production
    url: https://psono.pw
204
  only:
205
    - /^v[0-9]*\.[0-9]*\.[0-9]*$/
206

207

208 209 210 211 212 213
deploy-github:
  except:
    - schedules
  stage: deploy
  image: psono-docker.jfrog.io/docker:git
  services:
Sascha Pfeiffer's avatar
Sascha Pfeiffer committed
214
    - docker:18-dind
215 216 217 218 219 220 221 222 223
  script:
    - sh ./var/deploy-github.sh
  environment:
    name: github
    url: https://github.com/psono/psono-client
  only:
    - /^v[0-9]*\.[0-9]*\.[0-9]*$/


224
deploy-chrome:
chickahoona's avatar
chickahoona committed
225 226
  except:
    - schedules
227
  stage: deploy
228
  image: psono-docker.jfrog.io/ubuntu:16.04
229
  script:
230
    - sh ./var/build-ubuntu.sh
231
    - sh ./var/deploy-chrome-extension.sh
chickahoona's avatar
chickahoona committed
232 233 234
  environment:
    name: chrome-webstore
    url: https://chrome.google.com/webstore/detail/psonopw/eljmjmgjkbmpmfljlmklcfineebidmlo
235
  only:
236
    - /^v[0-9]*\.[0-9]*\.[0-9]*$/
237

238

239
deploy-firefox:
chickahoona's avatar
chickahoona committed
240 241
  except:
    - schedules
242
  stage: deploy
243
  image: psono-docker.jfrog.io/ubuntu:16.04
244
  script:
245
    - sh ./var/build-ubuntu.sh
246 247 248 249 250 251
    - 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]*$/
chickahoona's avatar
chickahoona committed
252

253 254 255
deploy-changelog:
  except:
    - schedules
256
  stage: deploy
257 258 259 260 261 262
  image: psono-docker.jfrog.io/ubuntu:16.04
  script:
    - sh ./var/deploy_changelog.sh
  environment:
    name: static.psono.com
    url: https://static.psono.com/gitlab.com/psono/psono-client/changelog.json
263 264
  only:
    - /^v[0-9]*\.[0-9]*\.[0-9]*$/
265