The purpose of this demo is to show how to use a bundle template and GitHub Actions to easily deploy the same code to different environments, such as development, staging, and production.
Official docs about DABS Template: DABS template docs
This demo is intended to be used with VSCode, but it can work in any IDE/setup.
With VSCode, everything is easier, but in this example, we will be using the command line.
-
Clone this repo with
git clone:git clone https://github.com/malcolndandaro/dabs_notebook_github_actions
-
Create an empty directory with your project name (we will use
demo_exampleas the project name):mkdir demo_example
Now you should have this folder structure:
../ | dabs_notebook_github_actions | demo_example -
Go inside the new folder you just created and turn it into a repo:
cd demo_example git init -
Use DABS with the template we just cloned:
databricks bundle init ../dabs_notebook_github_actions
-
Commit on
mainwithout any changes:git add . git commit -m "v1"
-
Push/Publish your repo to GitHub.
-
In your GitHub repo, go to
Settings -> Secrets and Variables -> Actions -> New Repository Secret:
Add a new secret with the name:SP_TOKENand the value as a token generated in Databricks:
Settings -> Developer -> Access Tokens -
In your VSCode, create a new branch with the name
dev:git checkout -b dev
-
Now you can develop your notebook, commit, and push this branch to GitHub. This will trigger the first GitHub Action.
-
Create a Pull Request from
devtomain. This will trigger the second GitHub Action. -
Approve the PR, which will trigger the final GitHub Action.