-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathbase_azure_db_stage.yml
63 lines (58 loc) · 1.42 KB
/
base_azure_db_stage.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
#
.base_azure_db_admin_secrets:
before_script:
- \. <(kubectl get secret azure-pg-admin-user -n ${CI_PROJECT_NAME}-secret -o json | export_from_k8s_secret)
.base_azure_db:
image: ghcr.io/socialgouv/docker/azure-db:7.5.1
dependencies: []
only:
refs:
- branches
variables:
- $ENABLE_AZURE_POSTGRES
except:
refs:
- master
variables:
GIT_STRATEGY: none
#
NEW_DB_NAME: db_${CI_COMMIT_SHORT_SHA}
NEW_USER: user_${CI_COMMIT_SHORT_SHA}@${PGHOST}
NEW_PASSWORD: pass_${CI_COMMIT_SHORT_SHA}
DROP_DATABASE: db_${CI_COMMIT_SHORT_SHA}
DROP_USER: user_${CI_COMMIT_SHORT_SHA}@${PGHOST}
.base_create_azure_db:
extends:
- .base_azure_db
- .base_azure_db_admin_secrets
stage: Registration
allow_failure: true
variables:
NEW_DB_EXTENSIONS: "pgcrypto hstore"
script:
- export PGUSER="${ADMIN_PG_USER}"
- export PGPASSWORD="${ADMIN_PG_PASSWORD}"
- create-db-user
.base_drop_azure_db:
extends:
- .base_azure_db
- .base_azure_db_admin_secrets
stage: "Clean Up"
when: manual
allow_failure: true
script:
- export PGUSER="${ADMIN_PG_USER}"
- export PGPASSWORD="${ADMIN_PG_PASSWORD}"
- drop-db-user
.base_clean_azure_db:
extends:
- .base_azure_db
- .base_azure_db_admin_secrets
stage: "Clean Up"
variables:
GIT_STRATEGY: clone
GIT_DEPTH: "500"
allow_failure: true
script:
- git pull --all
- /bin/clean-dbs