-
Notifications
You must be signed in to change notification settings - Fork 6
/
.gitlab-ci.yml
204 lines (182 loc) · 5.17 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
image: humancellatlas/dss-build-box
# The Docker image `humancellatlas/dss-build-box` is created through a manual process from
# `${DSS_HOME}/allspark.Dockerfile`. See the contents of `${DSS_HOME}/allspark.Dockerfile` # creation and usage instructions.
variables:
GIT_SUBMODULE_STRATEGY: normal
DSS_ES_TIMEOUT: 30
DSS_UNITTEST_OPTS: "-v -b"
GITHUB_API: "https://api.github.com"
stages:
- trufflehog
- test
- deploy
- fusillade
- integration_test
- scale_and_performance
- release
before_script:
- date && date -u
# TODO: figure out how to get the gitlab-runner to not clone the repo as root - Brian H
- virtualenv ~/venv
- source ~/venv/bin/activate
- pip install -r requirements-dev.txt
- source environment
- if [[ -f "environment.$CI_COMMIT_REF_NAME" ]]; then
- source environment.$CI_COMMIT_REF_NAME
- fi
- scripts/dss-ops.py secrets get application_secrets.json > application_secrets.json
- scripts/dss-ops.py secrets get gcp-credentials.json > gcp-credentials.json
- export GOOGLE_APPLICATION_CREDENTIALS=$(pwd -P)/gcp-credentials.json
.tests:
stage: test
except:
- tags
- schedules
trufflehog:
stage: trufflehog
script:
- pip install trufflehog
- wget -O regex.json https://raw.githubusercontent.com/HumanCellAtlas/dcplib/master/components/trufflehog_regex_patterns.json
- trufflehog --regex --rules regex.json --entropy=False https://github.com/HumanCellAtlas/data-store.git
unit_tests:
extends: .tests
script:
- make -j4 parallel_test
test_search:
extends: .tests
script:
- make -j1 tests/test_search.py
test_aws_indexer:
extends: .tests
variables:
DSS_UNITTEST_OPTS: "-b -v TestAWSIndexer"
script:
- make -j1 tests/test_indexer.py
test_gcp_indexer:
extends: .tests
variables:
DSS_UNITTEST_OPTS: "-b -v TestGCPIndexer"
script:
- make -j1 tests/test_indexer.py
test_subscriptions:
extends: .tests
script:
- make -j1 tests/test_subscriptions.py
setup_fusillade:
stage: fusillade
script:
- git clone -b master https://github.com/HumanCellAtlas/dcp-fusillade.git
- cd dcp-fusillade
- source environment
- cd ..
# need to re-source data-store environment in case dcp-fusillade overwrites vars (e.g. AWS_DEFAULT_REGION)
- source environment
- if [[ -f "environment.$CI_COMMIT_REF_NAME" ]]; then
- source environment.$CI_COMMIT_REF_NAME
- fi
- cat ./roles.json | sed "s/\${stage}/${DSS_DEPLOYMENT_STAGE}/g" > temp-roles.json
- if [ "$DSS_DEPLOYMENT_STAGE" == "dev" ]; then
- FUS_STAGE='testing'
- else
- FUS_STAGE=$DSS_DEPLOYMENT_STAGE
- fi
- python -m json.tool ./temp-roles.json > /dev/null || exit 1
- dcp-fusillade/scripts/setup_fusillade.py --file temp-roles.json --force $FUS_STAGE
- scripts/check_fusillade.py $FUS_STAGE
except:
- schedules
only:
- master
- integration
- staging
deploy:
stage: deploy
script:
- make plan-infra
- make deploy
- scripts/set_version.sh
environment:
name: $CI_COMMIT_REF_NAME
# TODO: include url when GitLab fixes it's wonky interpolation rules
# Variable created in this file (outside of `variables`) are not interpolated,
# causing GitLabs environment mechanism to fail silently.
# issue: https://gitlab.com/gitlab-com/support-forum/issues/2814
# fix: https://gitlab.com/gitlab-org/gitlab-ce/issues/27921
# - Brian Hannafiouus
# url: https://dss.{dev/integration/master}.data.humancellatlas.org
only:
- master
- integration
- staging
except:
- schedules
integration_test:
stage: integration_test
script:
- make -j1 integration_test
only:
- master
- integration
- staging
except:
- schedules
variables:
DSS_UNITTEST_OPTS: "-v"
scale_and_performance:
stage: scale_and_performance
script:
- echo $DSS_JOB_COMMAND
- $DSS_JOB_COMMAND
only:
variables:
- $DSS_JOB_COMMAND
.release:
stage: release
script:
- git remote set-url origin https://$GITHUB_TOKEN@github.com/HumanCellAtlas/data-store.git
- export status=$(scripts/status.py HumanCellAtlas dcp $(echo $RELEASE_COMMAND | cut -d ' ' -f 3))
- if [[ ${RELEASE_COMMAND} != *"--force"* && ${status} != "success" ]]; then
- echo "DCP Integration test returned status ${status}";
- exit 1
- fi
- ${RELEASE_COMMAND}
except:
- schedules
when: manual
allow_failure: true
release_integration:
extends: .release
variables:
RELEASE_COMMAND: scripts/release.sh master integration
only:
- master
force_release_integration:
extends: .release
variables:
RELEASE_COMMAND: scripts/release.sh master integration --force
only:
- master
release_staging:
extends: .release
variables:
RELEASE_COMMAND: scripts/release.sh integration staging
only:
- integration
force_release_staging:
extends: .release
variables:
RELEASE_COMMAND: scripts/release.sh integration staging --force
only:
- integration
release_prod:
extends: .release
variables:
RELEASE_COMMAND: scripts/release.sh staging prod
only:
- staging
force_release_prod:
extends: .release
variables:
RELEASE_COMMAND: scripts/release.sh staging prod --force
only:
- staging