-
Notifications
You must be signed in to change notification settings - Fork 5
60 lines (45 loc) · 1.88 KB
/
bigquery_cleanup.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
name: bigquery_cleanup
on:
schedule:
- cron: "0 1 * * *"
jobs:
cleanup_stg:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: stg
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Save stg GCP credentials to runner
run: |
echo "${{ secrets.DBT_CICD_SA_SECRET_KEY_STG_BASE64_ENCODED }}" | base64 --decode >> ./service_account.json && \
export GOOGLE_APPLICATION_CREDENTIALS="$(pwd)/service_account.json"
- name: Authenticate with GCP
run: |
gcloud auth activate-service-account [email protected] --key-file=./service_account.json && \
gcloud config set project beyond-basics-stg
- name: Install python packages
run: pip install -r requirements.txt -r requirements_dev.txt
- run: python ./scripts/drop_unused_bq_resources.py --dataset_pattern "cicd_" --environment stg
cleanup_prd:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: prd
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Save prd GCP credentials to runner
run: |
echo "${{ secrets.DBT_CICD_SA_SECRET_KEY_PRD_BASE64_ENCODED }}" | base64 --decode >> ./service_account.json && \
export GOOGLE_APPLICATION_CREDENTIALS="$(pwd)/service_account.json"
- name: Authenticate with GCP
run: |
gcloud auth activate-service-account [email protected] --key-file=./service_account.json && \
gcloud config set project beyond-basics-prd
- name: Install python packages
run: pip install -r requirements.txt -r requirements_dev.txt
- run: python ./scripts/drop_unused_bq_resources.py --dataset_pattern "cicd_" --environment prd