Run a CI/CD workflow with a Databricks Asset Bundle and GitHub Actions (2024)

  • Documentation
  • Develop on Databricks
  • Developer tools and guidance
  • What are Databricks Asset Bundles?
  • Run a CI/CD workflow with a Databricks Asset Bundle and GitHub Actions

This article describes how to run a CI/CD (continuous integration/continuous deployment) workflow in GitHub with GitHub Actions and a Databricks Asset Bundle. See What are Databricks Asset Bundles?

You can use GitHub Actions along with Databricks CLI bundle commands to automate, customize, and run your CI/CD workflows from within your GitHub repositories.

You can add GitHub Actions YAML files such as the following to your repo’s .github/workflows directory. The following example GitHub Actions YAML file validates, deploys, and runs the specified job in the bundle within a pre-production target named “qa” as defined within a bundle configuration file. This example GitHub Actions YAML file relies on the following:

  • A bundle configuration file at the root of the repository, which is explicitly declared through the GitHub Actions YAML file’s setting working-directory: . (This setting can be omitted if the bundle configuration file is already at the root of the repository.) This bundle configuration file defines a Databricks workflow named my-job and a target named qa. See Databricks Asset Bundle configurations.

  • A GitHub secret named SP_TOKEN, representing the Databricks access token for a Databricks service principal that is associated with the Databricks workspace to which this bundle is being deployed and run. See Encrypted secrets.

# This workflow validates, deploys, and runs the specified bundle# within a pre-production target named "qa".name: "QA deployment"# Ensure that only a single job or workflow using the same concurrency group# runs at a time.concurrency: 1# Trigger this workflow whenever a pull request is opened against the repo's# main branch or an existing pull request's head branch is updated.on: pull_request: types: - opened - synchronize branches: - mainjobs: # Used by the "pipeline_update" job to deploy the bundle. # Bundle validation is automatically performed as part of this deployment. # If validation fails, this workflow fails. deploy: name: "Deploy bundle" runs-on: ubuntu-latest steps: # Check out this repo, so that this workflow can access it. - uses: actions/checkout@v3 # Download the Databricks CLI. # See https://github.com/databricks/setup-cli - uses: databricks/setup-cli@main # Deploy the bundle to the "qa" target as defined # in the bundle's settings file. - run: databricks bundle deploy working-directory: . env: DATABRICKS_TOKEN: ${{ secrets.SP_TOKEN }} DATABRICKS_BUNDLE_ENV: qa # Validate, deploy, and then run the bundle. pipeline_update: name: "Run pipeline update" runs-on: ubuntu-latest # Run the "deploy" job first. needs: - deploy steps: # Check out this repo, so that this workflow can access it. - uses: actions/checkout@v3 # Use the downloaded Databricks CLI. - uses: databricks/setup-cli@main # Run the Databricks workflow named "my-job" as defined in the # bundle that was just deployed. - run: databricks bundle run my-job --refresh-all working-directory: . env: DATABRICKS_TOKEN: ${{ secrets.SP_TOKEN }} DATABRICKS_BUNDLE_ENV: qa

The following GitHub Actions YAML file can exist in the same repo as the preceding file. This file validates, deploys, and runs the specified bundle within a production target named “prod” as defined within a bundle configuration file. This example GitHub Actions YAML file relies on the following:

  • A bundle configuration file at the root of the repository, which is explicitly declared through the GitHub Actions YAML file’s setting working-directory: . (This setting can be omitted if the bundle configuration file is already at the root of the repository.). This bundle configuration file defines a Databricks workflow named my-job and a target named prod. See Databricks Asset Bundle configurations.

  • A GitHub secret named SP_TOKEN, representing the Databricks access token for a Databricks service principal that is associated with the Databricks workspace to which this bundle is being deployed and run. See Encrypted secrets.

# This workflow validates, deploys, and runs the specified bundle# within a production target named "prod".name: "Production deployment"# Ensure that only a single job or workflow using the same concurrency group# runs at a time.concurrency: 1# Trigger this workflow whenever a pull request is pushed to the repo's# main branch.on: push: branches: - mainjobs: deploy: name: "Deploy bundle" runs-on: ubuntu-latest steps: # Check out this repo, so that this workflow can access it. - uses: actions/checkout@v3 # Download the Databricks CLI. # See https://github.com/databricks/setup-cli - uses: databricks/setup-cli@main # Deploy the bundle to the "prod" target as defined # in the bundle's settings file. - run: databricks bundle deploy working-directory: . env: DATABRICKS_TOKEN: ${{ secrets.SP_TOKEN }} DATABRICKS_BUNDLE_ENV: prod # Validate, deploy, and then run the bundle. pipeline_update: name: "Run pipeline update" runs-on: ubuntu-latest # Run the "deploy" job first. needs: - deploy steps: # Check out this repo, so that this workflow can access it. - uses: actions/checkout@v3 # Use the downloaded Databricks CLI. - uses: databricks/setup-cli@main # Run the Databricks workflow named "my-job" as defined in the # bundle that was just deployed. - run: databricks bundle run my-job --refresh-all working-directory: . env: DATABRICKS_TOKEN: ${{ secrets.SP_TOKEN }} DATABRICKS_BUNDLE_ENV: prod
Run a CI/CD workflow with a Databricks Asset Bundle and GitHub Actions (2024)
Top Articles
Arsenal or Bayern Munich: Who will win the race for Declan Rice
FC Bayern München - Wunschtransfer Declan Rice: Ist er mehr als 100 Millionen Euro wert?
NOAA: National Oceanic & Atmospheric Administration hiring NOAA Commissioned Officer: Inter-Service Transfer in Spokane Valley, WA | LinkedIn
Bin Stores in Wisconsin
Us 25 Yard Sale Map
Melfme
GAY (and stinky) DOGS [scat] by Entomb
Skip The Games Norfolk Virginia
Truist Drive Through Hours
Autozone Locations Near Me
Corporate Homepage | Publix Super Markets
Cranberry sauce, canned, sweetened, 1 slice (1/2" thick, approx 8 slices per can) - Health Encyclopedia
Erin Kate Dolan Twitter
Caliber Collision Burnsville
charleston cars & trucks - by owner - craigslist
97226 Zip Code
Lola Bunny R34 Gif
Hannaford To-Go: Grocery Curbside Pickup
If you have a Keurig, then try these hot cocoa options
Uncovering The Mystery Behind Crazyjamjam Fanfix Leaked
Best Sports Bars In Schaumburg Il
Finding Safety Data Sheets
Idle Skilling Ascension
11526 Lake Ave Cleveland Oh 44102
The Collective - Upscale Downtown Milwaukee Hair Salon
12657 Uline Way Kenosha Wi
Halsted Bus Tracker
Rubmaps H
The Rise of "t33n leaks": Understanding the Impact and Implications - The Digital Weekly
6465319333
Worlds Hardest Game Tyrone
Sedano's Supermarkets Expands to Orlando - Sedano's Supermarkets
What Time Does Walmart Auto Center Open
Shoreone Insurance A.m. Best Rating
Sinai Sdn 2023
Why Holly Gibney Is One of TV's Best Protagonists
Delaware judge sets Twitter, Elon Musk trial for October
Ktbs Payroll Login
Busted Newspaper Campbell County KY Arrests
A Comprehensive 360 Training Review (2021) — How Good Is It?
California Craigslist Cars For Sale By Owner
Bill Manser Net Worth
Smite Builds Season 9
Dragon Ball Super Super Hero 123Movies
Goats For Sale On Craigslist
From Grindr to Scruff: The best dating apps for gay, bi, and queer men in 2024
Movie Hax
Mit diesen geheimen Codes verständigen sich Crew-Mitglieder
Grand Park Baseball Tournaments
Guy Ritchie's The Covenant Showtimes Near Look Cinemas Redlands
Game Like Tales Of Androgyny
Craigslist Indpls Free
Latest Posts
Article information

Author: Tish Haag

Last Updated:

Views: 5613

Rating: 4.7 / 5 (67 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Tish Haag

Birthday: 1999-11-18

Address: 30256 Tara Expressway, Kutchburgh, VT 92892-0078

Phone: +4215847628708

Job: Internal Consulting Engineer

Hobby: Roller skating, Roller skating, Kayaking, Flying, Graffiti, Ghost hunting, scrapbook

Introduction: My name is Tish Haag, I am a excited, delightful, curious, beautiful, agreeable, enchanting, fancy person who loves writing and wants to share my knowledge and understanding with you.