-
Notifications
You must be signed in to change notification settings - Fork 8
/
.gitlab-ci.yml
114 lines (102 loc) · 2.99 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
image: docker.texta.ee/texta/texta-rest-base-image:latest
variables:
# Elastic
TEXTA_ES_URL: http://texta-elastic:9200
# Redis
TEXTA_REDIS_URL: redis://redis:6379
# UAA
TEXTA_USE_UAA: "True"
TEXTA_UAA_REDIRECT_URI: http://localhost:8000/api/v2/uaa/callback
TEXTA_UAA_USER: test
TEXTA_UAA_EMAIL: [email protected]
TEXTA_UAA_PWD: test
TEXTA_UAA_URL: http://texta-uaa:8080/uaa
TEXTA_UAA_FRONT_REDIRECT_URL: http://localhost:4200/#/oauth/uaa
TEXTA_UAA_CLIENT_ID: login
TEXTA_UAA_CLIENT_SECRET: loginsecret
# For keeping plots as artifacts
TEXTA_TEST_KEEP_PLOT_FILES: "True"
# Set admin password for tests
#TEXTA_ADMIN_PASSWORD: "1234"
# MLP lang codes
TEXTA_LANGUAGE_CODES: et,en
TEXTA_EXTERNAL_DATA_DIR: /cache
# S3 components
TEXTA_S3_ENABLED: "true"
TEXTA_S3_HOST: $S3_HOST_URI
TEXTA_S3_BUCKET_NAME: texta-models-test
TEXTA_S3_ACCESS_KEY: $S3_ACCESS_KEY
TEXTA_S3_SECRET_KEY: $S3_SECRET_KEY
TEXTA_S3_USE_SECURE: "true"
services:
- name: redis:6
- name: docker.texta.ee/texta/texta-uaa:latest
alias: texta-uaa
- name: docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2
alias: texta-elastic
command: [ "bin/elasticsearch", "-Ediscovery.type=single-node" ]
stages:
- test-back
- build-test-image
- update_changelog
- test-and-build-front
- build-final-image
TestBack:
# Tests back-end locally
before_script:
- source activate texta-rest
# Cant use the manage.py command because the startup checks populate the stdout.
- python -c 'from cryptography.fernet import Fernet;print(Fernet.generate_key().decode("utf8").strip())' > secret.key
- python import_test_data.py -es $TEXTA_ES_URL
- python migrate.py
stage: test-back
tags:
- ci-test
script:
- sh wait-for-uaa.sh
- python manage.py test
except:
- tags
BuildTestImage:
# Builds back image for front tests
stage: build-test-image
tags:
- with-docker
script:
- docker login -u $CI_DEPLOY_USER -p $CI_DEPLOY_PASSWORD docker.texta.ee
- docker build --compress --force-rm --no-cache -t docker.texta.ee/texta/texta-rest/test:latest -f ./docker/Dockerfile .
- docker push docker.texta.ee/texta/texta-rest/test:latest
- docker system prune -a
only:
- master
update-changelog:
stage: update_changelog
tags:
- ci-update-version
script:
- currentVersion=$(grep -m1 '' VERSION)
- |
curl --header "PRIVATE-TOKEN: $TTK_GITLAB_TOKEN" --data "version=$currentVersion&branch=master" "https://git.texta.ee/api/v4/projects/77/repository/changelog"
except:
- tags
only:
- master
TestAndBuildFront:
# Executes front pipeline
stage: test-and-build-front
trigger:
project: texta/texta-rest-front
strategy: depend
only:
- master
BuildFinalImage:
# Builds final image with new front
stage: build-final-image
tags:
- with-docker
script:
- docker login -u $CI_DEPLOY_USER -p $CI_DEPLOY_PASSWORD docker.texta.ee
- sh ./docker/build_and_push.sh
- docker system prune -a
only:
- tags