-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
216 lines (202 loc) · 6.83 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
204
205
206
207
208
209
210
211
212
213
214
215
216
stages:
- lint
- test
- build
- test-deploy
- test-destroy
before_script:
- export TERM=xterm
- export TAG="${CI_COMMIT_TAG:-${CI_COMMIT_REF_SLUG}}"
- export CLEARED_TAG=${TAG//[^a-zA-Z0-9]/} # remove dots in tags and all characters except letters and numbers
yamllint:
stage: lint
script:
- make bootstrap-dev
- make linter-yamllint
tags:
- dle-test
ansible-lint:
stage: lint
script:
- make bootstrap-dev
- make linter-ansible-lint
tags:
- dle-test
molecule-test:
stage: test
script:
- make bootstrap-dev
- make molecule-test
allow_failure: true # allow build image even if the test failed
tags:
- dle-test
build:
stage: build
script:
- echo 'Building & pushing container image with tag ${TAG}'
- echo "${DOCKER_REGISTRY_PASSWORD}" | docker login --username $DOCKER_REGISTRY_USER --password-stdin $DOCKER_REGISTRY
- docker build --no-cache -t postgresai/dle-se-ansible:$TAG .
- docker push postgresai/dle-se-ansible:$TAG
when: manual
tags:
- dle-test
deploy-test-hetzner:
stage: test-deploy
script: |
docker run --rm \
--env HCLOUD_API_TOKEN=${HCLOUD_API_TOKEN} \
postgresai/dle-se-ansible:$TAG \
ansible-playbook deploy_dle.yml --extra-vars \
"provision='hetzner' \
server_name='dblab-ci-test-hetzner-$CLEARED_TAG' \
server_type='CCX13' \
server_image='ubuntu-22.04' \
server_location='ash' \
volume_size='30' \
dblab_engine_verification_token='ci-test-token' \
dblab_engine_version='3.5.0' \
zpool_datasets_number='2' \
platform_org_key=${PLATFORM_ORG_KEY} \
platform_url='https://v2.postgres.ai/api/general' \
platform_project_name='dblab-ci-test-hetzner-$CLEARED_TAG'"
when: manual
tags:
- dle-test
destroy-test-hetzner:
stage: test-destroy
script: |
docker run --rm \
--env HCLOUD_API_TOKEN=${HCLOUD_API_TOKEN} \
postgresai/dle-se-ansible:$TAG \
ansible-playbook cloud_resources.yml --extra-vars \
"provision='hetzner' \
server_name='dblab-ci-test-hetzner-$CLEARED_TAG' \
server_type='CCX13' \
server_location='ash' \
state='absent' \
platform_org_key=${PLATFORM_ORG_KEY} \
platform_project_name='dblab-ci-test-hetzner-$CLEARED_TAG'"
when: manual
tags:
- dle-test
deploy-test-digitalocean:
stage: test-deploy
script: |
docker run --rm \
--env DO_API_TOKEN=${DO_API_TOKEN} \
postgresai/dle-se-ansible:$TAG \
ansible-playbook deploy_dle.yml --extra-vars \
"provision='digitalocean' \
server_name='dblab-ci-test-digitalocean-$CLEARED_TAG' \
server_type='g-2vcpu-8gb' \
server_image='ubuntu-22-04-x64' \
server_location='nyc1' \
volume_size='30' \
dblab_engine_verification_token='ci-test-token' \
dblab_engine_version='3.5.0' \
zpool_datasets_number='2' \
platform_org_key=${PLATFORM_ORG_KEY} \
platform_url='https://v2.postgres.ai/api/general' \
platform_project_name='dblab-ci-test-digitalocean-$CLEARED_TAG'"
when: manual
tags:
- dle-test
destroy-test-digitalocean:
stage: test-destroy
script: |
docker run --rm \
--env DO_API_TOKEN=${DO_API_TOKEN} \
postgresai/dle-se-ansible:$TAG \
ansible-playbook cloud_resources.yml --extra-vars \
"provision='digitalocean' \
server_name='dblab-ci-test-digitalocean-$CLEARED_TAG' \
server_type='g-2vcpu-8gb' \
server_location='nyc1' \
state='absent' \
platform_org_key=${PLATFORM_ORG_KEY} \
platform_project_name='dblab-ci-test-digitalocean-$CLEARED_TAG'"
when: manual
tags:
- dle-test
# TODO: Enable tests on AWS when access issues are fixed
#deploy-test-aws:
# stage: test-deploy
# script: |
# docker run --rm \
# --env AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
# --env AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
# postgresai/dle-se-ansible:$TAG \
# ansible-playbook deploy_dle.yml --extra-vars \
# "provision='aws' \
# server_name='dblab-ci-test-aws-$CLEARED_TAG' \
# server_type='t2.medium' \
# server_image='ami-07d445a5585fce0a1' \
# server_location='us-east-2' \
# volume_size='30' \
# dblab_engine_verification_token='ci-test-token' \
# dblab_engine_version='3.5.0' \
# zpool_datasets_number='2' \
# platform_org_key=${PLATFORM_ORG_KEY} \
# platform_url='https://v2.postgres.ai/api/general' \
# platform_project_name='dblab-ci-test-aws-$CLEARED_TAG'"
# when: manual
# tags:
# - dle-test
#destroy-test-aws:
# stage: test-destroy
# script: |
# docker run --rm \
# --env AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
# --env AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
# postgresai/dle-se-ansible:$TAG \
# ansible-playbook cloud_resources.yml --extra-vars \
# "provision='aws' \
# server_name='dblab-ci-test-aws-$CLEARED_TAG' \
# server_type='t2.medium' \
# server_location='us-east-2' \
# state='absent' \
# platform_org_key=${PLATFORM_ORG_KEY} \
# platform_project_name='dblab-ci-test-aws-$CLEARED_TAG'"
# when: manual
# tags:
# - dle-test
# TODO
#deploy-test-gcp:
# stage: test-deploy
# script: |
# docker run --rm \
# --env GCP_SERVICE_ACCOUNT_CONTENTS="${GCP_SERVICE_ACCOUNT_CONTENTS}" \
# postgresai/dle-se-ansible:$TAG \
# ansible-playbook deploy_dle.yml --extra-vars \
# "provision='gcp' \
# server_name='dblab-ci-test-gcp-$CLEARED_TAG' \
# server_type='n2-standard-2' \
# server_image='projects/ubuntu-os-cloud/global/images/family/ubuntu-2204-lts' \
# server_location='us-central1' \
# volume_size='30' \
# dblab_engine_verification_token='ci-test-token' \
# dblab_engine_version='3.5.0' \
# zpool_datasets_number='2' \
# platform_org_key=${PLATFORM_ORG_KEY} \
# platform_url='https://v2.postgres.ai/api/general' \
# platform_project_name='dblab-ci-test-gcp-$CLEARED_TAG'"
# when: manual
# tags:
# - dle-test
#destroy-test-gcp:
# stage: test-destroy
# script: |
# docker run --rm \
# --env GCP_SERVICE_ACCOUNT_CONTENTS="${GCP_SERVICE_ACCOUNT_CONTENTS}" \
# postgresai/dle-se-ansible:$TAG \
# ansible-playbook cloud_resources.yml --extra-vars \
# "provision='gcp' \
# server_name='dblab-ci-test-gcp-$CLEARED_TAG' \
# server_type='n2-standard-2' \
# server_location='us-central1' \
# state='absent' \
# platform_org_key=${PLATFORM_ORG_KEY} \
# platform_project_name='dblab-ci-test-gcp-$CLEARED_TAG'"
# when: manual
# tags:
# - dle-test