This repository has been archived by the owner on Dec 4, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
177 lines (156 loc) · 4.39 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
image: quay.io/ucsc_cgl/dss-build-box
# The Docker image `quay.io/ucsc_cgl/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"
AWS_DEFAULT_REGION: us-east-1
stages:
- trufflehog
- test
- deploy
- 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
- export [email protected]
- 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 gitdb2==3.0.0 truffleHog==2.0.99 # https://github.com/dxa4481/truffleHog/issues/200
- 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/DataBiosphere/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
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://[email protected]/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