Sub topic 17
CI/CD and Databricks Asset Bundles
This chapter assumes you can commit, push, and open a pull request from a Git folder, and that you know how a notebook runs as a job task.
Why Git folders are not enough
A Git folder gives you version control for code. It does not decide what runs in production. If a job points at a notebook in someone's working branch, the next edit changes production behavior. Continuous integration and continuous delivery (CI/CD) fixes this with a rule: only code that has been reviewed and merged is deployed, and a script does the deploying.
What a bundle is
A Databricks Asset Bundle is a folder in your repository with a databricks.yml file. The file describes your jobs, their notebooks, and the workspaces they deploy to, as code. The Databricks CLI reads it and creates or updates those resources. Because the file lives in Git, job definitions get the same review as notebooks.
bundle:
name: daily_load
targets:
dev:
mode: development
default: true
workspace:
host: https://adb-1111111111111111.1.azuredatabricks.net
prod:
mode: production
workspace:
host: https://adb-2222222222222222.2.azuredatabricks.net
root_path: /Workspace/Shared/.bundle/${bundle.name}/${bundle.target}
resources:
jobs:
daily_load_job:
name: daily_load
tasks:
- task_key: load
notebook_task:
notebook_path: ./notebooks/daily_load.py
base_parameters:
run_date: "2026-01-01"A target is a named deployment environment. development mode prefixes resource names with your user name, so your test job does not overwrite a teammate's. The base_parameters values fill the notebook's widgets, such as run_date. This example sets no compute for the task, so the job relies on serverless compute for jobs. If your workspace does not support that, add a cluster setting to the task.
The commands
databricks bundle validate
databricks bundle deploy -t dev
databricks bundle run -t dev daily_load_jobvalidate checks the configuration. deploy uploads the files and creates or updates the job. run starts the job.
A pipeline around the bundle
A typical setup follows these steps:
- You develop on a feature branch in a Git folder and deploy to
devto test. - A pull request triggers a CI job that runs
bundle validateand your tests. - After review, the merge to
maintriggers a CD job that runsbundle deploy -t prod.
The CI and CD jobs run in your Git provider's tooling, such as GitHub Actions. They authenticate to Databricks with a service principal, a non-human identity, so no personal token is stored in the pipeline.
Common errors
- Deploying to prod from a laptop. Let the pipeline do it, so prod always matches
main. - Forgetting
-t. Without it the CLI uses the default target, which isdevhere. - Keeping a hand-edited job in the UI. The next deploy overwrites its changes.
Exercise
A teammate edits the schedule of a bundle-deployed job in the workspace UI. What happens at the next databricks bundle deploy, and what is the correct way to make the change?
Show answer
The deploy overwrites the UI edit with the schedule in databricks.yml. Make the change in the YAML file on a branch, get it reviewed, and let the pipeline deploy it.