-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
77 lines (71 loc) · 2.25 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
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
cache: &build_cache
paths:
- build.json
policy: pull
build:
stage: build
script:
- git submodule init
- git submodule update
- skaffold build --file-output=build.json
cache:
<<: *build_cache
policy: push
test-lint:
stage: test
script:
- export BACKEND_IMAGE=$(cat build.json | jq -r '.builds[] | select(.imageName | endswith("/backend")) | .tag')
- docker run --rm "$BACKEND_IMAGE" flake8 kocherga/
cache:
<<: *build_cache
test-js:
stage: test
script:
- export FRONTEND_IMAGE=$(cat build.json | jq -r '.builds[] | select(.imageName | endswith("/frontend")) | .tag')
- docker run --rm "$FRONTEND_IMAGE" bash -c "npx jest --no-watchman --coverage"
cache:
<<: *build_cache
test-python:
stage: test
script:
- export BACKEND_IMAGE=$(cat build.json | jq -r '.builds[] | select(.imageName | endswith("/backend")) | .tag')
- export CHROME_IMAGE=$(cat build.json | jq -r '.builds[] | select(.imageName | endswith("/chrome")) | .tag')
- docker-compose -f ./ops/ci/docker-compose.yml run --rm core-django bash -c "pytest -m 'not google and not slack and not mailchimp and not ofd and not vk and not timepad and not slow'"
cache:
<<: *build_cache
deploy_production:
stage: deploy
script:
- mkdir -p ops/secrets/core/prod
- |
set -e
set -o pipefail
for FILE in main.yaml secrets.py KKMServer.pem; do
curl -f -X GET -H "X-Vault-Token: $VAULT_TOKEN" https://vault.team.kocherga.club/v1/kv/data/chart-secrets/core/prod/$FILE | jq -r .data.data.content >ops/secrets/core/prod/$FILE
done
- kubectl delete job core-django-migrate || true # temporary hack until skaffold issues are fixed
- skaffold deploy -a build.json --status-check
cache:
<<: *build_cache
environment:
name: production
url: https://kocherga-club.ru
when: manual
allow_failure: false
only:
- master
#deploy_beta:
# stage: deploy
# script:
# # NOTE: we don't migrate the DB for beta environment (yet).
# # deploy
# - skaffold deploy -a build.json --status-check
# cache:
# <<: *build_cache
# environment:
# name: beta
# url: https://beta.kocherga-club.ru
# only:
# - master