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

Added support for Databricks Apps in DABs #1928

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

Conversation

andrewnester
Copy link
Contributor

@andrewnester andrewnester commented Nov 21, 2024

Changes

Added support for Databricks Apps in DABs.

It's possible to configure new app resource in bundle and point it to the custom source_code_path location where Databricks App code is define.
On databricks bundle deploy DABs will create an app and execute app deployment with the pointed files.
All consecutive databricks bundle deploy execution will trigger new app deployments.

Here's an example of configuration:

bundle:
  name: apps

variables:
  my_job_id:
    description: "ID of job to run app"
    lookup:
      job: "My Job"
  databricks_name:
    description: "Name for app user"
  additional_flags:
    description: "Additional flags to run command app"
    default: ""
  my_app_config:
    type: complex
    description: "Configuration for my Databricks App"
    default:
      command:
        - flask
        - --app
        - hello
        - run
        - ${var.additional_flags}
      env:
        - name: DATABRICKS_NAME
          value: ${var.databricks_name}

resources:
  apps:
    my_app:
      name: "anester-app" # required and has to be unique
      description: "My App"
      source_code_path: ./app # required and points to location of app code
      config: ${var.my_app_config}
      resources:
        - name: "my-job"
          description: "A job for app to be able to run"
          job:
            id: ${var.my_job_id}
            permission: "CAN_MANAGE_RUN"
      permissions:
        - user_name: "[email protected]"
          level: "CAN_VIEW"
        - service_principal_name: "my_sp"
          level: "CAN_MANAGE"

targets:
  dev:
    variables:
      databricks_name: "Andrew (from dev)"
      additional_flags: --debug
  
  prod:
    variables:
      databricks_name: "Andrew (from prod)"

Note: relies on not yet released TF change: databricks/terraform-provider-databricks#4099

TODO:

  • Integration test for deploying app
  • App permission support

Tests

Added unit and config tests + manual test.

@@ -0,0 +1,102 @@
// Generated from Databricks Terraform provider schema. DO NOT EDIT.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

All of the TF changes regenerated based on local TF override with this branch databricks/terraform-provider-databricks#4099

Will be updated when the change is released in TF provider and provider updated in CLI

Copy link

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/cli

Inputs:

  • PR number: 1928
  • Commit SHA: cfcb787fbc0698df5729eb4ee2b6fcd733258067

Checks will be approved automatically on success.

@eng-dev-ecosystem-bot
Copy link
Collaborator

Test Details: go/deco-tests/11957790217

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants