Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Databricks Sample - Terraform IaC for Azure Databricks and Asset Bundle Deployment via CI/CD #911

Open
wants to merge 31 commits into
base: main
Choose a base branch
from

Conversation

DilmurodMak
Copy link

Pull Request Overview

This PR updates and enhances the Databricks deployment process using Terraform and Asset Bundle Deployment via GitHub Actions. It simplifies deployment for multi environment deployment.

Key Highlights

  • Folder Structure:
    • Sample Code is Organized under single_tech_samples/databricks/databricks_terraform
    • Includes directories for:
      • Infra: Terraform code for Azure resource deployment.
      • tests: Scripts and workflows for Databricks testing.
      • utils: Helper scripts like generate-databricks-workflows.sh.
      • workflows: Pre-generated Databricks workflows to run tests in Databricks workspace.
  • CI/CD Pipelines:
    • Linting Pipeline: Validates Python notebooks and workflows.
    • Sandbox Deployment: Validates and deploys Databricks assets, executes test workflows.
    • Development Deployment: Deploys assets to the development environment following successful sandbox deployment and runs the same tests in development environment

Testing Steps

The Sample code covers the deployment from sandbox to development environment.

  1. Create a new branch and submit a PR to main.
  2. Verify the following:
    • Linting Pipeline runs and validates code.
    • Sandbox Deployment Pipeline validates and tests workflows during the PR.
  3. Merge the PR to main.
  4. Observe:
    • Sandbox assets are deployed, and test workflows are executed successfully.
    • Development deployment triggers upon successful sandbox completion.

@ydaponte
Copy link
Collaborator

ydaponte commented Dec 4, 2024

@DilmurodMak - one of the validations is failing, can you take a look?

@ydaponte ydaponte added the single-tech: azure-databricks Related to Azure Databricks single-tech sample label Dec 4, 2024
@DilmurodMak
Copy link
Author

DilmurodMak commented Dec 4, 2024

@DilmurodMak - one of the validations is failing, can you take a look?

@ydaponte , The pipeline are templates, it requires databricks workspaces exist and its urls are set in databricks.yml file. There for its failing. We can put it as template reference in the single solution doc instead of running in PRs if we do not want to trigger it

Copy link
Collaborator

@ydaponte ydaponte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving some comments that need to be addressed before we can merge into main. There are some best practices and alignment with the overall repo that will need to be done as for example the creation of a devcontainer for the sample. Thanks for the great work so far!


### Pre-requisites
- Clone the repository
- Install Terraform CLI if not installed already [Terraform Installation](https://learn.hashicorp.com/tutorials/terraform/install-cli)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add this pre-requirements to be installed when launching the devcontainer

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of the png, can you please commit the drawio.svg version file of this diagram? We are starting to create a standard in the repo for that.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These was originally images, I will try to recreate in draw.io if necessary

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an editable version of this diagram that can be commited instead?

@DilmurodMak DilmurodMak requested a review from ydaponte December 16, 2024 18:22
Copy link
Collaborator

@ydaponte ydaponte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't run the container - the req.txt file is missing. Can you upload it so I can further test? Thanks!

&& apt clean

# Copy and install dev dependencies
COPY requirements-dev.txt /tmp/requirements-dev.txt
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The requirements-dev.txt file is missing. The devcontainer build is failing with this error: ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref bfc31110-fef0-4a1d-8108-d3bf8d65de30::x6ufq090g3b3ngzwutfeemidk: "/requ
irements-dev.txt": not found

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ydaponte, I see it was missing. I just added.

Copy link
Collaborator

@ydaponte ydaponte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just leaving the comment as we discussed earlier today.


**NOTE** - *When **`adb-workspace`** module runs it creates databricks workspace, and by default it creates a metastore in the same region. Databricks allows only **ONE METASTORE** per region. **`metastore-and-users`** module deploys new metastore with our required configurations, but we have to delete existing metastore prior running the module*

**NOTE** - *During script execution you will receive `Error: cannot create metastore: This account with id <Account_ID> has reached the limit for metastores in region <Region>` * error. This is because we have reached the limit of metastores in the region. To fix this, we need to delete existing metastore and re-run the script.*
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change the script to check if the metastore already exists? If it doesn't exist we create it but if exists we should reuse it. In the environment where I'm testing we do have already a metastore and I can't delete it. I can point to a different region to workaround the problem, but realistically if someone wants to try chances are that the metastore already exists most of the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
single-tech: azure-databricks Related to Azure Databricks single-tech sample
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants