-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.gitlab-ci.yml
177 lines (156 loc) · 4.28 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
image: ubuntu:19.04
cache:
paths:
- .cache
variables:
AWS_DEFAULT_REGION: us-east-1
AWS_DEFAULT_OUTPUT: json
DEBIAN_FRONTEND: noninteractive
TERRAFORM_VERSION: 0.12.12
LC_ALL: C.UTF-8
LANG: C.UTF-8
TF_CLI_ARGS_apply: --auto-approve
stages:
- test
- deploy
- integration_test
- release
before_script:
- source /etc/profile
- apt-get update > /dev/null
- apt-get install --yes sudo jq moreutils gettext make virtualenv postgresql zip unzip httpie git > /dev/null
- service postgresql start
- sudo -u postgres createuser --superuser $(whoami)
- curl -Os https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip
- unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d /usr/local/bin
- virtualenv --python=python3.7 .venv
- source .venv/bin/activate
- pip install --quiet -r requirements-dev.txt
- if [[ $CI_COMMIT_REF_NAME =~ ^(staging|integration|prod)$ ]]; then export DEPLOYMENT_STAGE=$CI_COMMIT_REF_NAME; fi
- source environment
- aws secretsmanager get-secret-value --secret-id ${APP_NAME}/${STAGE}/gcp-credentials.json | jq -r .SecretString > gcp-credentials.json
- export GOOGLE_APPLICATION_CREDENTIALS=$(pwd -P)/gcp-credentials.json
.test:
stage: test
except:
- tags
script:
- make init-db migrate-db load-test-data init-tf
- make test
.deploy:
stage: deploy
except:
- tags
- schedules
script:
- make deploy
.integration_test:
stage: integration_test
except:
- tags
script:
- make integration-test
.release:
stage: release
script:
- git remote set-url origin https://[email protected]/HumanCellAtlas/query-service
- export branch=$(echo $RELEASE_COMMAND | cut -d ' ' -f 2)
- export status=$(scripts/status.py $branch --owner HumanCellAtlas --repo dcp)
- if [[ $branch != master && $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
test_dev:
extends: .test
only:
variables:
- $CI_API_V4_URL == "https://allspark.dev.data.humancellatlas.org/api/v4"
except:
refs:
- prod
deploy_dev:
extends: .deploy
only:
variables:
- $CI_API_V4_URL == "https://allspark.dev.data.humancellatlas.org/api/v4"
refs:
- master
- integration
- staging
integration_test_dev:
extends: .integration_test
only:
variables:
- $CI_API_V4_URL == "https://allspark.dev.data.humancellatlas.org/api/v4"
refs:
- master
- integration
- staging
release_integration:
extends: .release
when: on_success
variables:
RELEASE_COMMAND: scripts/release.sh master integration --no-deploy --skip-account-verification
only:
- master
force_release_integration:
extends: .release
variables:
RELEASE_COMMAND: scripts/release.sh master integration --force --no-deploy --skip-account-verification
only:
- master
release_staging:
extends: .release
variables:
RELEASE_COMMAND: scripts/release.sh integration staging --no-deploy --skip-account-verification
only:
- integration
force_release_staging:
extends: .release
variables:
RELEASE_COMMAND: scripts/release.sh integration staging --force --no-deploy --skip-account-verification
only:
- integration
release_prod:
extends: .release
variables:
RELEASE_COMMAND: scripts/release.sh staging prod --no-deploy --skip-account-verification
only:
- staging
force_release_prod:
extends: .release
variables:
RELEASE_COMMAND: scripts/release.sh staging prod --force --no-deploy --skip-account-verification
only:
- staging
test_prod:
extends: .test
only:
variables:
- $CI_API_V4_URL == "https://allspark-prod.data.humancellatlas.org/api/v4"
refs:
- prod
deploy_prod:
extends: .deploy
only:
variables:
- $CI_API_V4_URL == "https://allspark-prod.data.humancellatlas.org/api/v4"
refs:
- prod
integration_test_prod:
extends: .integration_test
only:
variables:
- $CI_API_V4_URL == "https://allspark-prod.data.humancellatlas.org/api/v4"
refs:
- prod
scale_test:on-schedule:
only:
- schedules
script:
- python -m tests.scale.test_scale