Skip to content

second run of bundle deploy breaks app permissions to run job/pipeline #4309

@na-wapf

Description

@na-wapf

Describe the issue

The first time I run bundle deploy everything works (see databricks.yaml extract below):

  • Observing the job config in the databricks UI confirms that my_job has my_app's uuid listed with CAN_MANAGE_RUN
  • Running the app, it can trigger my_job no problem

The second time I run bundle deploy the CAN_MANAGE_RUN permission disappears form the job.

  • Observing databricks UI for my_job no longer lists my app in the permissions
  • App can no longer trigger the job (see error message below)

Workaround

One way to fix this is bundle destroy followed by bundle deploy; this is unacceptable workaround as it changes the URL for the app.

The only other way is to remember to open the databricks UI manually click "disconnect resource" and "edit permissions" every time 😢

Configuration

Please provide a minimal reproducible configuration for the issue

# extract from databricks.yml
resources:
  apps:
    my_app:
      name: portal
      source_code_path: "../dist_app"
      resources:
        - name: "my-job-id"
          job:
            id: ${resources.jobs.my_job.id}
            permission: CAN_MANAGE_RUN
  jobs:
    my_job:
      name: My Job
      tasks:
        - ...
      queue:
        enabled: true
      environments:
        - environment_key: Default
          spec:
            environment_version: "4"
      performance_target: PERFORMANCE_OPTIMIZED

Steps to reproduce the behavior

Please list the steps required to reproduce the issue, for example:

  1. Run databricks bundle deploy ...
  2. Run databricks bundle run ...
  3. See error

Expected Behavior

bundle deploy should be idempotent and not break permissions when it is run a second time.

Actual Behavior

Error message from app logz

databricks.sdk.errors.platform.PermissionDenied: User [[my_app service principal uuid]] does not have Manage Run or Owner or Admin permissions on job [my_job id number]. Config: host=[[databricks host url]], client_id=[[app client id]], client_REDACTED_SECRET auth_type=oauth-m2m. Env: DATABRICKS_HOST, DATABRICKS_CLIENT_ID, DATABRICKS_CLIENT_SECRET

OS and CLI version

Linux mcr.microsoft.com/devcontainers/typescript-node:1-22-bookworm
Databricks CLI v0.281.0

Edit: I just tested this with Databricks CLI v0.283.0 and the problem persists

Is this a regression?

Unknown

Debug Logs

mmm if you can tell me which bit you need to see it would be easier?

Do you want to see the contents of 04:00:39 Debug: POST /api/2.0/workspace-files/import-file/Workspace/Bundles/my_bundle/state/terraform.tfstate?overwrite=true the body of this request is the only place I see "job": {"id": ...,"permission": "CAN_MANAGE_RUN"},

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingDABsDABs related issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions