-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
125 lines (112 loc) · 3.61 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
stages:
- lint
- build-and-test
.job_template: &backend_definition
image: python:3.7.4-slim
cache:
key: "$CI_COMMIT_REF_SLUG-python_packages"
paths:
- backend/.cache/pip
- backend/venv/
before_script:
- cd backend
- python -V
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
- pip install -r requirements.txt
.job_template: &frontend_user_definition
image: node:10.16.3-jessie-slim
before_script:
- node -v
- npm -v
- cd frontend/user
- npm install
cache:
key: "$CI_COMMIT_REF_SLUG-node_modules"
paths:
- frontend/user/node_modules
# https://docs.gitlab.com/ee/ci/docker/using_docker_build.html
.job_template: &definition_build
image: docker:19.03.1
variables:
# When using dind service we need to instruct docker, to talk with the
# daemon started inside of the service. The daemon is available with
# a network connection instead of the default /var/run/docker.sock socket.
#
# The 'docker' hostname is the alias of the service container as described at
# https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#accessing-the-services
#
# Note that if you're using the Kubernetes executor, the variable should be set to
# tcp://localhost:2375 because of how the Kubernetes executor connects services
# to the job container
#DOCKER_HOST: tcp://localhost:2375
#
# For non-Kubernetes executors, we use tcp://docker:2375
DOCKER_HOST: tcp://docker:2375
#
# This will instruct Docker not to start over TLS.
DOCKER_TLS_CERTDIR: ""
services:
- docker:19.03.1-dind
before_script:
- docker info
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
.job_template: &frontend_admin_definition
image: node:10.16.3-jessie-slim
before_script:
- node -v
- npm -v
- cd frontend/admin
- npm install
cache:
key: "$CI_COMMIT_REF_SLUG-node_modules"
paths:
- frontend/admin/node_modules
backend-lint:
<<: *backend_definition
stage: lint
script:
- pylint JDISCTF seeds
frontend-user-lint:
<<: *frontend_user_definition
stage: lint
script:
- npm run lint -- --no-fix
backend-build:
<<: *definition_build
stage: build-and-test
script:
- cd backend
- docker pull $CI_REGISTRY_IMAGE:backend_latest || true
- docker build --cache-from $CI_REGISTRY_IMAGE:backend_latest --tag $CI_REGISTRY_IMAGE:backend_$CI_COMMIT_SHA --tag $CI_REGISTRY_IMAGE:backend_latest .
- docker push $CI_REGISTRY_IMAGE:backend_$CI_COMMIT_SHA
- docker push $CI_REGISTRY_IMAGE:backend_latest
frontend-user-build:
<<: *definition_build
stage: build-and-test
script:
- cd frontend/user
- docker pull $CI_REGISTRY_IMAGE:user_latest || true
- docker build --cache-from $CI_REGISTRY_IMAGE:user_latest --tag $CI_REGISTRY_IMAGE:user_$CI_COMMIT_SHA --tag $CI_REGISTRY_IMAGE:user_latest .
- docker push $CI_REGISTRY_IMAGE:user_$CI_COMMIT_SHA
- docker push $CI_REGISTRY_IMAGE:user_latest
frontend-admin-build:
<<: *definition_build
stage: build-and-test
script:
- cd frontend/admin
- docker pull "$CI_REGISTRY_IMAGE":admin_latest || true
- docker build --cache-from "$CI_REGISTRY_IMAGE":admin_latest --tag "$CI_REGISTRY_IMAGE":admin_$CI_COMMIT_SHA --tag "$CI_REGISTRY_IMAGE":admin_latest .
- docker push "$CI_REGISTRY_IMAGE":admin_$CI_COMMIT_SHA
- docker push "$CI_REGISTRY_IMAGE":admin_latest
backend-test:
<<: *backend_definition
stage: build-and-test
script:
- pytest
frontend-admin-lint:
<<: *frontend_admin_definition
stage: lint
script:
- npm run lint -- --no-fix