Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f48965e
ci: add dev deploy pipeline
AnselmoBorges Oct 12, 2025
f864e05
subindo
AnselmoBorges Oct 12, 2025
24b4046
fix: corrigir MIME metadata do dabdbt/index.html
anselmoborgesblip Oct 12, 2025
cc522f5
feat: migrar para serverless compute
anselmoborgesblip Oct 12, 2025
6ad7b38
fix: corrigir configuração de cluster para permitir acesso do srv_eng…
anselmoborgesblip Oct 12, 2025
c4d4a5b
feat: usar cluster shared existente para todas as tasks
anselmoborgesblip Oct 12, 2025
08c1e7f
fix: corrigir comandos dbt para resolver problemas de profiles directory
anselmoborgesblip Oct 12, 2025
9112342
fix: simplificar configuração dbt para resolver problemas de profiles
anselmoborgesblip Oct 12, 2025
94937b2
fix: corrigir project_directory para resolver problema de dbt_project…
anselmoborgesblip Oct 12, 2025
6dafb19
fix: adicionar --profiles-dir=dbt_profiles para resolver problema de …
anselmoborgesblip Oct 12, 2025
5607b5c
fix: remover comandos pwd que não são permitidos em dbt_task
anselmoborgesblip Oct 12, 2025
d3a85d6
fix: usar profiles_directory correto em vez de --profiles-dir
anselmoborgesblip Oct 12, 2025
3c2c7c1
fix: corrigir profiles_directory para usar caminho relativo
anselmoborgesblip Oct 12, 2025
b2177be
fix: corrigir host do workspace para incluir barra final
anselmoborgesblip Oct 12, 2025
6ea34cd
fix: ajustar project_directory para resolver problema de caminho dupl…
anselmoborgesblip Oct 12, 2025
73a60c6
fix: ajustar configuração dbt para resolver problemas de caminho
anselmoborgesblip Oct 12, 2025
0a3155d
cleanup: remover arquivos de configuração desnecessários
anselmoborgesblip Oct 12, 2025
efd95b5
Refine dbt job for serverless run
AnselmoBorges Oct 12, 2025
1da52df
Remove legacy vars and docs script
AnselmoBorges Oct 12, 2025
d0f0020
Fix Azure auth for blob metadata action
AnselmoBorges Oct 12, 2025
75f36ea
Add production deployment workflow
AnselmoBorges Oct 12, 2025
8d74675
Parameterize source database by target
AnselmoBorges Oct 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Deploy dabdbt (dev)

on:
push:
branches: [dev]
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest
environment: dev
permissions:
contents: read
id-token: write
env:
DATABRICKS_HOST: ${{ vars.DATABRICKS_HOST }}
DATABRICKS_CLIENT_ID: ${{ secrets.DATABRICKS_CLIENT_ID }}
DATABRICKS_CLIENT_SECRET: ${{ secrets.DATABRICKS_CLIENT_SECRET }}
DATABRICKS_TENANT_ID: ${{ secrets.DATABRICKS_TENANT_ID }}
DATABRICKS_TOKEN: ${{ secrets.DATABRICKS_TOKEN }}
DATABRICKS_PROFILE: dev-github
DBT_DEV_HTTP_PATH: ${{ secrets.DBT_DEV_HTTP_PATH }}
AZURE_STORAGE_ACCOUNT: ${{ vars.AZURE_STORAGE_ACCOUNT }}
AZURE_STORAGE_CONTAINER: '$web'
AZURE_BLOB_PATH: 'dabdbt/index.html'
AZURE_BLOB_CONTENT_TYPE: 'text/html; charset=utf-8'
AZURE_BLOB_CONTENT_DISPOSITION: inline
AZURE_SUBSCRIPTION_ID: '${{ secrets.AZURE_SUBSCRIPTION_ID }}'

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Install Databricks CLI
run: |
curl -fsSL https://raw.githubusercontent.com/databricks/setup-cli/main/install.sh | bash
echo "${HOME}/.databricks/bin" >> "$GITHUB_PATH"
echo "${HOME}/bin" >> "$GITHUB_PATH"

- name: Configure Databricks profile (Service Principal or PAT)
run: |
set -euo pipefail
mkdir -p ~/.databricks
if [ -n "${DATABRICKS_CLIENT_ID:-}" ] && [ -n "${DATABRICKS_CLIENT_SECRET:-}" ]; then
printf '[%s]\nhost = %s\nclient_id = %s\nclient_secret = %s\n' "${DATABRICKS_PROFILE}" "${DATABRICKS_HOST}" "${DATABRICKS_CLIENT_ID}" "${DATABRICKS_CLIENT_SECRET}" > ~/.databrickscfg
if [ -n "${DATABRICKS_TENANT_ID:-}" ]; then
printf 'tenant_id = %s\n' "${DATABRICKS_TENANT_ID}" >> ~/.databrickscfg
fi
elif [ -n "${DATABRICKS_TOKEN:-}" ]; then
printf '[%s]\nhost = %s\ntoken = %s\n' "${DATABRICKS_PROFILE}" "${DATABRICKS_HOST}" "${DATABRICKS_TOKEN}" > ~/.databrickscfg
else
echo "Missing Databricks credentials: set secrets.DATABRICKS_CLIENT_ID/SECRET or secrets.DATABRICKS_TOKEN" >&2
exit 1
fi

- name: Deploy bundle to Databricks (dev)
working-directory: dabdbt
run: |
databricks bundle deploy --target dev --profile "${DATABRICKS_PROFILE}"

- name: Run dabdbt_job (dev)
working-directory: dabdbt
run: |
databricks bundle run dabdbt_job --target dev --profile "${DATABRICKS_PROFILE}"

- name: Authenticate with Azure
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Set Azure subscription
if: env.AZURE_SUBSCRIPTION_ID != ''
run: |
az account set --subscription "${AZURE_SUBSCRIPTION_ID}"

- name: Fix static website MIME metadata
run: |
az storage blob update \
--account-name "${AZURE_STORAGE_ACCOUNT}" \
--container-name "${AZURE_STORAGE_CONTAINER}" \
--name "${AZURE_BLOB_PATH}" \
--content-type "${AZURE_BLOB_CONTENT_TYPE}" \
--content-disposition "${AZURE_BLOB_CONTENT_DISPOSITION}" \
--auth-mode login


93 changes: 93 additions & 0 deletions .github/workflows/deploy-prd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Deploy dabdbt (prd)

on:
push:
branches: [main]
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest
environment: prd
permissions:
contents: read
id-token: write
env:
DATABRICKS_HOST: ${{ vars.DATABRICKS_HOST }}
DATABRICKS_CLIENT_ID: ${{ secrets.DATABRICKS_CLIENT_ID }}
DATABRICKS_CLIENT_SECRET: ${{ secrets.DATABRICKS_CLIENT_SECRET }}
DATABRICKS_TENANT_ID: ${{ secrets.DATABRICKS_TENANT_ID }}
DATABRICKS_TOKEN: ${{ secrets.DATABRICKS_TOKEN }}
DATABRICKS_PROFILE: prd-github
AZURE_STORAGE_ACCOUNT: ${{ vars.AZURE_STORAGE_ACCOUNT }}
AZURE_STORAGE_CONTAINER: '$web'
AZURE_BLOB_PATH: 'dabdbt/index.html'
AZURE_BLOB_CONTENT_TYPE: 'text/html; charset=utf-8'
AZURE_BLOB_CONTENT_DISPOSITION: inline
AZURE_SUBSCRIPTION_ID: '${{ secrets.AZURE_SUBSCRIPTION_ID }}'

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Install Databricks CLI
run: |
curl -fsSL https://raw.githubusercontent.com/databricks/setup-cli/main/install.sh | bash
echo "${HOME}/.databricks/bin" >> "$GITHUB_PATH"
echo "${HOME}/bin" >> "$GITHUB_PATH"

- name: Configure Databricks profile (Service Principal or PAT)
run: |
set -euo pipefail
mkdir -p ~/.databricks
if [ -n "${DATABRICKS_CLIENT_ID:-}" ] && [ -n "${DATABRICKS_CLIENT_SECRET:-}" ]; then
printf '[%s]\nhost = %s\nclient_id = %s\nclient_secret = %s\n' "${DATABRICKS_PROFILE}" "${DATABRICKS_HOST}" "${DATABRICKS_CLIENT_ID}" "${DATABRICKS_CLIENT_SECRET}" > ~/.databrickscfg
if [ -n "${DATABRICKS_TENANT_ID:-}" ]; then
printf 'tenant_id = %s\n' "${DATABRICKS_TENANT_ID}" >> ~/.databrickscfg
fi
elif [ -n "${DATABRICKS_TOKEN:-}" ]; then
printf '[%s]\nhost = %s\ntoken = %s\n' "${DATABRICKS_PROFILE}" "${DATABRICKS_HOST}" "${DATABRICKS_TOKEN}" > ~/.databrickscfg
else
echo "Missing Databricks credentials: set secrets.DATABRICKS_CLIENT_ID/SECRET or secrets.DATABRICKS_TOKEN" >&2
exit 1
fi

- name: Deploy bundle to Databricks (prd)
working-directory: dabdbt
run: |
databricks bundle deploy --target prd --profile "${DATABRICKS_PROFILE}"

- name: Run dabdbt_job (prd)
working-directory: dabdbt
run: |
databricks bundle run dabdbt_job --target prd --profile "${DATABRICKS_PROFILE}"

- name: Authenticate with Azure
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Set Azure subscription
if: env.AZURE_SUBSCRIPTION_ID != ''
run: |
az account set --subscription "${AZURE_SUBSCRIPTION_ID}"

- name: Fix static website MIME metadata
run: |
az storage blob update \
--account-name "${AZURE_STORAGE_ACCOUNT}" \
--container-name "${AZURE_STORAGE_CONTAINER}" \
--name "${AZURE_BLOB_PATH}" \
--content-type "${AZURE_BLOB_CONTENT_TYPE}" \
--content-disposition "${AZURE_BLOB_CONTENT_DISPOSITION}" \
--auth-mode login
5 changes: 4 additions & 1 deletion dabdbt/databricks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ variables:
prod_root_path:
description: Workspace path for production bundle deployment
default: /Workspace/Users/anselmoborges@gmail.com/.bundle/${bundle.name}/${bundle.target}
source_olist_env:
description: Target suffix used by Unity Catalog foreign catalog
default: ${bundle.target}
prod_owner_user:
description: User principal that will retain CAN_MANAGE in production
default: anselmoborges@gmail.com
Expand All @@ -28,7 +31,7 @@ targets:
mode: development
default: true
workspace:
host: https://adb-1293581597272291.11.azuredatabricks.net
host: https://adb-1293581597272291.11.azuredatabricks.net/

prd:
mode: production
Expand Down
126 changes: 0 additions & 126 deletions dabdbt/notebooks/publish_docs.py

This file was deleted.

Loading