-
Notifications
You must be signed in to change notification settings - Fork 44
170 lines (164 loc) · 5.61 KB
/
databricks.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
name: Databricks CI/CD
on:
push:
branches:
- main
paths:
- "clouds/databricks/**"
- ".github/workflows/databricks.yml"
pull_request:
paths:
- "clouds/databricks/**"
- ".github/workflows/databricks.yml"
workflow_dispatch:
workflow_call:
env:
PYTHON3_VERSION: 3.8.11
VIRTUALENV_VERSION: 20.21.1
GCLOUD_VERSION: 500.0.0
GOOGLE_SECRET_MANAGER_PROJECT: ${{ secrets.GOOGLE_SECRET_MANAGER_PROJECT }}
jobs:
test:
if: false
runs-on: ubuntu-20.04
timeout-minutes: 30
env:
DB_PREFIX: ci_${{ github.sha }}_${{ github.run_id }}_${{ github.run_attempt }}_
DB_CLUSTER_ID: ${{ secrets.DB_CLUSTER_ID_CI }}
DB_HTTP_PATH: ${{ secrets.DB_HTTP_PATH_CI }}
DB_HOST: ${{ secrets.DB_HOST_CI }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Auth google
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.CARTODB_ON_GCP_TERRAFORM_CI_CD_SERVICE_ACCOUNT_KEY }}
- name: Get secrets
id: secrets
uses: google-github-actions/get-secretmanager-secrets@v0
with:
secrets: |-
databricks-ci-token:projects/cartodb-on-gcp-terraform-ci-cd/secrets/terraform-databricks-aws-ciuser-token
- name: Check diff
uses: technote-space/get-diff-action@v4
- name: Setup scala
uses: olafurpg/setup-scala@v11
with:
java-version: [email protected]
- name: Setup python 3
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON3_VERSION }}
- name: Setup virtualenv
run: pip install virtualenv==${{ env.VIRTUALENV_VERSION }}
- name: Setup databricks cli
uses: microsoft/[email protected]
- name: Run linter and tests
env:
DB_TOKEN: ${{ steps.secrets.outputs.databricks-ci-token }}
run: |
cd clouds/databricks
make lint && \
make deploy && \
make test && \
make remove
deploy-internal:
if: github.ref_name == 'main'
needs: test
runs-on: ubuntu-20.04
timeout-minutes: 20
strategy:
matrix:
include:
- cluster_id: DB_CLUSTER_ID_CD
http_path: DB_HTTP_PATH_CD
host: DB_HOST_CD
env:
DB_CLUSTER_ID: ${{ secrets[matrix.cluster_id] }}
DB_HTTP_PATH: ${{ secrets[matrix.http_path] }}
DB_HOST: ${{ secrets[matrix.host] }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Auth google
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.CARTODB_ON_GCP_TERRAFORM_CI_CD_SERVICE_ACCOUNT_KEY }}
- name: Get secrets
id: secrets
uses: google-github-actions/get-secretmanager-secrets@v0
with:
secrets: |-
databricks-ci-token:projects/cartodb-on-gcp-terraform-ci-cd/secrets/terraform-databricks-aws-ciuser-token
- name: Check diff
uses: technote-space/get-diff-action@v4
- name: Setup scala
uses: olafurpg/setup-scala@v11
with:
java-version: [email protected]
- name: Setup python 3
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON3_VERSION }}
- name: Setup virtualenv
run: pip install virtualenv==${{ env.VIRTUALENV_VERSION }}
- name: Setup databricks cli
uses: microsoft/[email protected]
- name: Run deploy
env:
DB_TOKEN: ${{ steps.secrets.outputs.databricks-ci-token }}
run: |
cd clouds/databricks
make deploy production=1
publish:
needs: test
if: github.ref_name == 'stable'
runs-on: ubuntu-20.04
timeout-minutes: 10
env:
PACKAGE_BUCKET: gs://carto-analytics-toolbox-core/databricks
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup scala
uses: olafurpg/setup-scala@v11
with:
java-version: [email protected]
- name: Setup python 3
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON3_VERSION }}
- name: Setup virtualenv
run: pip install virtualenv==${{ env.VIRTUALENV_VERSION }}
- name: Auth google
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCLOUD_PRODUCTION_RELEASE_SA }}
project_id: ${{ secrets.GCLOUD_PRODUCTION_PROJECT }}
create_credentials_file: true
- name: Setup gcloud
uses: google-github-actions/setup-gcloud@v2
with:
version: ${{ env.GCLOUD_VERSION }}
project_id: ${{ secrets.GCLOUD_PRODUCTION_PROJECT }}
- name: Release
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
run: |
cd clouds/databricks
make ci-release-core production=1
- name: Create package
run: |
cd clouds/databricks
make create-package
- name: Publish package
run: |
cd clouds/databricks
gsutil -h "Content-Type:application/zip" -m cp dist/*.zip ${{ env.PACKAGE_BUCKET }}/
gsutil -h "Content-Type:application/zip" -m cp dist/*.zip ${{ env.PACKAGE_BUCKET }}/carto-analytics-toolbox-core-databricks-latest.zip
gsutil -h "Content-Type:application/json" -m cp dist/*.json ${{ env.PACKAGE_BUCKET }}/
gsutil -h "Content-Type:text/plain" -m cp dist/modules.sql ${{ env.PACKAGE_BUCKET }}/