Skip to content

Add bundle deployment auto-deploy attempts - #8188

Open
atreyadbrx wants to merge 1 commit into
dabs-ad-d4-dep-pr5-deletefrom
dabs-ad-d4-dep-pr6-attempts
Open

atreyadbrx wants to merge 1 commit into
dabs-ad-d4-dep-pr5-deletefrom
dabs-ad-d4-dep-pr6-attempts

Conversation

@atreyadbrx

@atreyadbrx atreyadbrx commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

This is #7943 under bundle deployment.

Changes

  • attempts lists the target's auto-deploy attempts, newest first, through ListAutoDeployAttempts. With an attempt ID, it shows that attempt through GetAutoDeployAttempt. It rejects an ID that is empty or contains /, since the ID becomes a segment of the attempt's name.
  • The fake queues an attempt when it creates a trigger, the way the service deploys the branch head right away.

Why

Users need to see whether their pushes deployed, and why a deploy failed.

Tests

acceptance/bundle/deployment/auto-deploy/attempts covers:

  • the list and one attempt from the fake
  • a failed attempt (stubbed, since the fake has no runner)
  • an unknown attempt ID, and an attempt's name passed instead of its ID
  • a target with no trigger

Also run against a staging workspace that serves the API, on an existing trigger: the list, one attempt in text and -o json (int64 run and job IDs, RFC 3339 times with milliseconds), and an unknown attempt ID, whose error is the same as the fake's.

Stacked on #8187.

This pull request and its description were written by Isaac.

@review-oss-bot review-oss-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Automated review at 5bfec4a. Each finding was verified against the code.

No blocking issues found. 4 non-blocking comment(s) below.

This PR adds bundle deployment auto-deploy attempts, which lists a target's auto-deploy attempts or shows one by ID. It also teaches the fake server to queue an attempt when a trigger is created and to serve the list and get routes. The command and API client follow the existing trigger patterns, and I found nothing that should block the merge. There are a few smaller points: the attempt ID check has gaps, the new attempts pagination path is never tested, the script breaks one rule from testing.md, and one output label is confusing.

Comments outside the changed lines

  • [nice to have] cmd/bundle/deployment/autodeploy/attempts.go:183: The check keeps the ID to a single segment, but it lets . and .. through. EncodeMultiSegmentPathParameter leaves dots unescaped, so attempts .. sends GET .../webhook-triggers/<id>/attempts/... A server or proxy that normalizes paths answers that with the trigger itself, and the command then prints an empty Attempt ID:/Status: instead of an error. Can we reject . and .. too? Can we also move the check above loadTrigger, or into Args? As written, a bad ID is reported only after the whole bundle is loaded, and a broken bundle or a missing origin hides it. Separately, attempts "" currently says "not its name", which doesn't fit an empty argument.
  • [nit] cmd/bundle/deployment/autodeploy/attempts.go:156: For a failed attempt, the output line Error: cannot create job: ... looks just like the CLI's own Error: prefix, even though the command succeeded. Maybe label it Failure: or Error message:?

Comment thread libs/testserver/gitwebhooks.go Outdated
// attempt stays queued.
if isNew {
attemptID := nextUUID()
s.GitWebhookAttempts[triggerID] = []gitwebhooks.AutoDeployAttempt{{

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[nice to have] The fake only queues an attempt when isNew, so every trigger ever has exactly one attempt. With gitWebhooksPageSize = 1, the req.PageToken = resp.NextPageToken branch of ListAutoDeployAttempts never runs, and the "newest first" order is never checked. Could the fake queue another attempt on an update, the way a push would? The attempts test would then list two attempts across two pages.

trace musterr $CLI bundle deployment auto-deploy attempts

$CLI bundle deployment auto-deploy create >> LOG.setup 2>&1
attempt_id=$($CLI bundle deployment auto-deploy attempts -o json | jq -r '.[0].attempt_id')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[nit] .agents/rules/testing.md says to use the acceptance/bin/ helpers instead of inline jq pipelines, and to prefer gron.py | grep field for single values. Can this read the attempt ID with gron.py instead of jq -r '.[0].attempt_id'?

@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Regression test report ✅

Commit: 0a1d5c61f | Workflow run

Selected 5 changed tests (limit=20, 0 not selected)

5 tests: regression=5 unreleased=0 coverage=0 failing=0
test branch main (4c4f104) latest (v1.28.0)
TestAccept/bundle/deployment/auto-deploy/attempts ✅ ❌ ❌
TestAccept/bundle/deployment/auto-deploy/create ✅ ❌ ❌
TestAccept/bundle/deployment/auto-deploy/delete ✅ ❌ ❌
TestAccept/bundle/deployment/auto-deploy/get ✅ ❌ ❌
TestAccept/bundle/deployment/auto-deploy/list ✅ ❌ ❌
TestAccept/bundle/deployment/auto-deploy/attempts: branch ✅ | main (4c4f104) ❌ | latest (v1.28.0) ❌

main (4c4f104):

acceptance_test.go:1402: Diff:
        --- bundle/deployment/auto-deploy/attempts/output.txt
        +++ /tmp/TestAcceptbundledeploymentauto-deployattempts4043980322/002/output.txt
        @@ -2,46 +2,42 @@
         === A target without a trigger
         
         >>> musterr [CLI] bundle deployment auto-deploy attempts
        -Error: target dev has no auto-deploy trigger that you can view. To create one, run: databricks bundle deployment auto-deploy create -t dev
        +Deployment related commands for managing bundle resource bindings.
         
        -=== Creating the trigger queues its first attempt
        +Use these commands to bind / unbind bundle definitions to existing workspace resources.
         
        ->>> [CLI] bundle deployment auto-deploy attempts
        -Attempt ID                            Status  Commit  Created
        -[UUID][0]  QUEUED          [TIMESTAMP]
        +Common workflow:
        +1. Generate configuration from existing resource:
        +   databricks bundle generate job --existing-job-id 12345 --key my_job
         
        ->>> [CLI] bundle deployment auto-deploy attempts [UUID][0]
        -Attempt ID: [UUID][0]
        -Status:     QUEUED
        -Created:    [TIMESTAMP]
        -{
        -  "method": "GET",
        -  "path": "/api/2.0/git-webhooks/webhook-triggers/[UUID][1]/attempts"
        -}
        -{
        -  "method": "GET",
        -  "path": "/api/2.0/git-webhooks/webhook-triggers/[UUID][1]/attempts/[UUID][0]"
        -}
        +2. Bind the bundle resource to the existing workspace resource:
        +   databricks bundle deployment bind my_job 12345
         
        -=== A failed attempt
        +3. Deploy updates - the bound resource will be updated in the workspace:
        +   databricks bundle deploy
         
        ->>> [CLI] bundle deployment auto-deploy attempts [UUID][2]
        -Attempt ID: [UUID][2]
        -Status:     FAILED
        -Commit:     0123456789abcdef0123456789abcdef01234567
        -Created:    [TIMESTAMP]
        -Completed:  [TIMESTAMP]
        -Stage:      RUN_BUNDLE_DEPLOY
        -Run ID:     7012345678901234
        -Error:      cannot create job: invalid cluster spec
        +After binding, the existing workspace resource will be managed by your bundle.
         
        -=== An attempt that does not exist
        +Usage:
        +  databricks bundle deployment [command]
         
        ->>> musterr [CLI] bundle deployment auto-deploy attempts [UUID][3]
        -Error: Auto-deploy attempt 'webhook-triggers/[UUID][1]/attempts/[UUID][3]' does not exist
        +Available Commands:
        +  bind        Bind bundle-defined resources to existing resources
        +  migrate     Migrate from Terraform to Direct deployment engine
        +  unbind      Unbind bundle-defined resources from its managed remote resource
         
        ->>> musterr [CLI] bundle deployment auto-deploy attempts webhook-triggers/x/attempts/y
        -Error: "webhook-triggers/x/attempts/y" is not an attempt ID. Pass the attempt_id of an attempt, not its name
        +Flags:
        +  -h, --help[=true|false]   help for deployment
         
        ->>> musterr [CLI] bundle deployment auto-deploy attempts ..
        -Error: ".." is not an attempt ID. Pass the attempt_id of an attempt, not its name
        +Global Flags:
        +      --debug[=true|false]   enable debug logging
        +  -o, --output type          output type: text or json (default text)
        +  -p, --profile string       ~/.databrickscfg profile
        +  -t, --target string        bundle target to use (if applicable)
        +      --var strings          set values for variables defined in bundle config. Example: --var="foo=bar"
        +
        +Use "databricks bundle deployment [command] --help" for more information about a command.
        +
        +Unexpected success
        +
        +Exit code: 1

latest (v1.28.0): same output as main (4c4f104)

TestAccept/bundle/deployment/auto-deploy/create: branch ✅ | main (4c4f104) ❌ | latest (v1.28.0) ❌

main (4c4f104):

acceptance_test.go:1402: Diff:
        --- bundle/deployment/auto-deploy/create/output.txt
        +++ /tmp/TestAcceptbundledeploymentauto-deploycreate5984146/002/output.txt
        @@ -2,289 +2,41 @@
         === The current branch, as the caller
         
         >>> [CLI] bundle deployment auto-deploy create
        -Pushes to branch main now deploy target dev as you.
        -Trigger ID: [UUID][0]
        -{
        -  "method": "PUT",
        -  "path": "/api/2.0/git-webhooks",
        -  "body": {
        -    "repo_url": "https://github.com/acme/repo",
        -    "git_provider": "GITHUB",
        -    "trigger_config": {
        -      "push_event": {
        -        "branch": "main"
        -      },
        -      "dabs_deploy": {
        -        "bundle_yml_repo_path": "databricks.yml",
        -        "deployment_mode": "dev"
        -      }
        -    }
        -  }
        -}
        +Deployment related commands for managing bundle resource bindings.
         
        -=== Updating the trigger keeps its ID
        +Use these commands to bind / unbind bundle definitions to existing workspace resources.
         
        ->>> [CLI] bundle deployment auto-deploy create --branch release --deploy-as [UUID][1]
        -Pushes to branch release now deploy target dev as [UUID][1].
        -Trigger ID: [UUID][0]
        -{
        -  "method": "PUT",
        -  "path": "/api/2.0/git-webhooks",
        -  "body": {
        -    "repo_url": "https://github.com/acme/repo",
        -    "git_provider": "GITHUB",
        -    "trigger_config": {
        -      "push_event": {
        -        "branch": "release"
        -      },
        -      "dabs_deploy": {
        -        "bundle_yml_repo_path": "databricks.yml",
        -        "deployment_mode": "dev",
        -        "deploy_as": {
        -          "service_principal_client_id": "[UUID][1]"
        -        }
        -      }
        -    }
        -  }
        -}
        +Common workflow:
        +1. Generate configuration from existing resource:
        +   databricks bundle generate job --existing-job-id 12345 --key my_job
         
        -=== As yourself, in JSON
        +2. Bind the bundle resource to the existing workspace resource:
        +   databricks bundle deployment bind my_job 12345
         
        ->>> [CLI] bundle deployment auto-deploy create -t prod --deploy-as [USERNAME] -o json
        -{
        -  "webhook_id": "[UUID][2]",
        -  "trigger_id": "[UUID][3]"
        -}
        -{
        -  "method": "PUT",
        -  "path": "/api/2.0/git-webhooks",
        -  "body": {
        -    "repo_url": "https://github.com/acme/repo",
        -    "git_provider": "GITHUB",
        -    "trigger_config": {
        -      "push_event": {
        -        "branch": "main"
        -      },
        -      "dabs_deploy": {
        -        "bundle_yml_repo_path": "databricks.yml",
        -        "deployment_mode": "prod",
        -        "deploy_as": {
        -          "user_email": "[USERNAME]"
        -        }
        -      }
        -    }
        -  }
        -}
        +3. Deploy updates - the bound resource will be updated in the workspace:
        +   databricks bundle deploy
         
        -=== As a service principal, on a production target that a user could not deploy
        +After binding, the existing workspace resource will be managed by your bundle.
         
        ->>> [CLI] bundle deployment auto-deploy create -t prod --deploy-as [UUID][1]
        -Pushes to branch main now deploy target prod as [UUID][1].
        -Trigger ID: [UUID][3]
        -{
        -  "method": "PUT",
        -  "path": "/api/2.0/git-webhooks",
        -  "body": {
        -    "repo_url": "https://github.com/acme/repo",
        -    "git_provider": "GITHUB",
        -    "trigger_config": {
        -      "push_event": {
        -        "branch": "main"
        -      },
        -      "dabs_deploy": {
        -        "bundle_yml_repo_path": "databricks.yml",
        -        "deployment_mode": "prod",
        -        "deploy_as": {
        -          "service_principal_client_id": "[UUID][1]"
        -        }
        -      }
        -    }
        -  }
        -}
        +Usage:
        +  databricks bundle deployment [command]
         
        -=== As another user
        +Available Commands:
        +  bind        Bind bundle-defined resources to existing resources
        +  migrate     Migrate from Terraform to Direct deployment engine
        +  unbind      Unbind bundle-defined resources from its managed remote resource
         
        ->>> musterr [CLI] bundle deployment auto-deploy create -t prod --deploy-as someone@example.com
        -Error: deploy_as.user_email must be your own email. To deploy as another identity, use a service principal you have the Service Principal User role on.
        +Flags:
        +  -h, --help[=true|false]   help for deployment
         
        -Host:      [DATABRICKS_URL]
        -Auth type: Personal Access Token (pat)
        +Global Flags:
        +      --debug[=true|false]   enable debug logging
        +  -o, --output type          output type: text or json (default text)
        +  -p, --profile string       ~/.databrickscfg profile
        +  -t, --target string        bundle target to use (if applicable)
        +      --var strings          set values for variables defined in bundle config. Example: --var="foo=bar"
         
        -Next steps:
        -  - Verify you have the required permissions for this operation
        -  - Check your identity: databricks auth describe
        -  - Consider setting up a profile: databricks auth login --profile <name>
        -{
        -  "method": "PUT",
        -  "path": "/api/2.0/git-webhooks",
        -  "body": {
        -    "repo_url": "https://github.com/acme/repo",
        -    "git_provider": "GITHUB",
        -    "trigger_config": {
        -      "push_event": {
        -        "branch": "main"
        -      },
        -      "dabs_deploy": {
        -        "bundle_yml_repo_path": "databricks.yml",
        -        "deployment_mode": "prod",
        -        "deploy_as": {
        -          "user_email": "someone@example.com"
        -        }
        -      }
        -    }
        -  }
        -}
        +Use "databricks bundle deployment [command] --help" for more information about a command.
        +File [OUTPUT_DIR]/out.requests.txt not found
         
        -=== A branch other than the target's git.branch
        -
        ->>> musterr [CLI] bundle deployment auto-deploy create -t prod --branch release
        -Error: git.branch is main for target prod, so a deploy from release would fail. Omit --branch, or change git.branch
        -
        -=== A git.branch from a variable
        -
        ->>> [CLI] bundle deployment auto-deploy create -t staging
        -Pushes to branch release now deploy target staging as you.
        -Trigger ID: [UUID][4]
        -{
        -  "method": "PUT",
        -  "path": "/api/2.0/git-webhooks",
        -  "body": {
        -    "repo_url": "https://github.com/acme/repo",
        -    "git_provider": "GITHUB",
        -    "trigger_config": {
        -      "push_event": {
        -        "branch": "release"
        -      },
        -      "dabs_deploy": {
        -        "bundle_yml_repo_path": "databricks.yml",
        -        "deployment_mode": "staging"
        -      }
        -    }
        -  }
        -}
        -
        -=== A git.branch that resolves to empty leaves the current branch
        -
        ->>> [CLI] bundle deployment auto-deploy create -t unpinned
        -Pushes to branch main now deploy target unpinned as you.
        -Trigger ID: [UUID][5]
        -
... (120 more lines truncated, raise DATABRICKS_CLI_TEST_MAX_LOG to see more)

latest (v1.28.0): same output as main (4c4f104)

TestAccept/bundle/deployment/auto-deploy/delete: branch ✅ | main (4c4f104) ❌ | latest (v1.28.0) ❌

main (4c4f104):

acceptance_test.go:1402: Diff:
        --- bundle/deployment/auto-deploy/delete/output.txt
        +++ /tmp/TestAcceptbundledeploymentauto-deploydelete93796776/002/output.txt
        @@ -1,78 +1,3 @@
        +rm: cannot remove '[OUTPUT_DIR]/out.requests.txt': No such file or directory
         
        -=== Without a terminal, delete needs --auto-approve, and sends nothing first
        -
        ->>> musterr [CLI] bundle deployment auto-deploy delete
        -Error: this deletes the auto-deploy trigger of the bundle target and the job that runs its deploys. To proceed, use --auto-approve.
        -
        -=== Deleting the target's trigger leaves the other target's
        -
        ->>> [CLI] bundle deployment auto-deploy delete --auto-approve
        -Deleted the auto-deploy trigger of target dev.
        -{
        -  "method": "DELETE",
        -  "path": "/api/2.0/git-webhooks/trigger",
        -  "body": {
        -    "repo_url": "https://github.com/acme/repo",
        -    "git_provider": "GITHUB",
        -    "trigger_config": {
        -      "push_event": {
        -        "branch": "main"
        -      },
        -      "dabs_deploy": {
        -        "bundle_yml_repo_path": "databricks.yml",
        -        "deployment_mode": "dev"
        -      }
        -    }
        -  }
        -}
        -
        ->>> [CLI] bundle deployment auto-deploy list
        -Target  Branch  Deploy as      Trigger ID
        -prod    main    you or a user  [UUID]
        -
        -=== A retried delete sends its body again
        -
        ->>> [CLI] bundle deployment auto-deploy delete -t prod --auto-approve
        -Deleted the auto-deploy trigger of target prod.
        -{
        -  "method": "DELETE",
        -  "path": "/api/2.0/git-webhooks/trigger",
        -  "body": {
        -    "repo_url": "https://github.com/acme/repo",
        -    "git_provider": "GITHUB",
        -    "trigger_config": {
        -      "push_event": {
        -        "branch": "main"
        -      },
        -      "dabs_deploy": {
        -        "bundle_yml_repo_path": "databricks.yml",
        -        "deployment_mode": "prod"
        -      }
        -    }
        -  }
        -}
        -{
        -  "method": "DELETE",
        -  "path": "/api/2.0/git-webhooks/trigger",
        -  "body": {
        -    "repo_url": "https://github.com/acme/repo",
        -    "git_provider": "GITHUB",
        -    "trigger_config": {
        -      "push_event": {
        -        "branch": "main"
        -      },
        -      "dabs_deploy": {
        -        "bundle_yml_repo_path": "databricks.yml",
        -        "deployment_mode": "prod"
        -      }
        -    }
        -  }
        -}
        -
        ->>> [CLI] bundle deployment auto-deploy list
        -Target  Branch  Deploy as  Trigger ID
        -
        -=== A target without a trigger
        -
        ->>> musterr [CLI] bundle deployment auto-deploy delete --auto-approve
        -Error: target dev has no auto-deploy trigger that you can view, so there is nothing to delete
        +Exit code: 1
        
    acceptance_test.go:1180: 
        LOG.setup: Deployment related commands for managing bundle resource bindings.
        LOG.setup: 
        LOG.setup: Use these commands to bind / unbind bundle definitions to existing workspace resources.
        LOG.setup: 
        LOG.setup: Common workflow:
        LOG.setup: 1. Generate configuration from existing resource:
        LOG.setup:    databricks bundle generate job --existing-job-id 12345 --key my_job
        LOG.setup: 
        LOG.setup: 2. Bind the bundle resource to the existing workspace resource:
        LOG.setup:    databricks bundle deployment bind my_job 12345
        LOG.setup: 
        LOG.setup: 3. Deploy updates - the bound resource will be updated in the workspace:
        LOG.setup:    databricks bundle deploy
        LOG.setup: 
        LOG.setup: After binding, the existing workspace resource will be managed by your bundle.
        LOG.setup: 
        LOG.setup: Usage:
        LOG.setup:   databricks bundle deployment [command]
        LOG.setup: 
        LOG.setup: Available Commands:
        LOG.setup:   bind        Bind bundle-defined resources to existing resources
        LOG.setup:   migrate     Migrate from Terraform to Direct deployment engine
        LOG.setup:   unbind      Unbind bundle-defined resources from its managed remote resource
        LOG.setup: 
        LOG.setup: Flags:
        LOG.setup:   -h, --help[=true|false]   help for deployment
        LOG.setup: 
        LOG.setup: Global Flags:
        LOG.setup:       --debug[=true|false]   enable debug logging
        LOG.setup:   -o, --output type          output type: text or json (default text)
        LOG.setup:   -p, --profile string       ~/.databrickscfg profile
        LOG.setup:   -t, --target string        bundle target to use (if applicable)
        LOG.setup:       --var strings          set values for variables defined in bundle config. Example: --var="foo=bar"
        LOG.setup: 
        LOG.setup: Use "databricks bundle deployment [command] --help" for more information about a command.
        LOG.setup: Deployment related commands for managing bundle resource bindings.
        LOG.setup: 
        LOG.setup: Use these commands to bind / unbind bundle definitions to existing workspace resources.
        LOG.setup: 
        LOG.setup: Common workflow:
        LOG.setup: 1. Generate configuration from existing resource:
        LOG.setup:    databricks bundle generate job --existing-job-id 12345 --key my_job
        LOG.setup: 
        LOG.setup: 2. Bind the bundle resource to the existing workspace resource:
        LOG.setup:    databricks bundle deployment bind my_job 12345
        LOG.setup: 
        LOG.setup: 3. Deploy updates - the bound resource will be updated in the workspace:
        LOG.setup:    databricks bundle deploy
        LOG.setup: 
        LOG.setup: After binding, the existing workspace resource will be managed by your bundle.
        LOG.setup: 
        LOG.setup: Usage:
        LOG.setup:   databricks bundle deployment [command]
        LOG.setup: 
        LOG.setup: Available Commands:
        LOG.setup:   bind        Bind bundle-defined resources to existing resources
        LOG.setup:   migrate     Migrate from Terraform to Direct deployment engine
        LOG.setup:   unbind      Unbind bundle-defined resources from its managed remote resource
        LOG.setup: 
        LOG.setup: Flags:
        LOG.setup:   -h, --help[=true|false]   help for deployment
        LOG.setup: 
        LOG.setup: Global Flags:
        LOG.setup:       --debug[=true|false]   enable debug logging
        LOG.setup:   -o, --output type          output type: text or json (default text)
        LOG.setup:   -p, --profile string       ~/.databrickscfg profile
        LOG.setup:   -t, --target string        bundle target to use (if applicable)
        LOG.setup:       --var strings          set values for variables defined in bundle config. Example: --var="foo=bar"
        LOG.setup: 
        LOG.setup: Use "databricks bundle deployment [command] --help" for more information about a command.

latest (v1.28.0): same output as main (4c4f104)

TestAccept/bundle/deployment/auto-deploy/get: branch ✅ | main (4c4f104) ❌ | latest (v1.28.0) ❌

main (4c4f104):

acceptance_test.go:1402: Diff:
        --- bundle/deployment/auto-deploy/get/output.txt
        +++ /tmp/TestAcceptbundledeploymentauto-deployget2556440569/002/output.txt
        @@ -2,84 +2,42 @@
         === A target without a trigger
         
         >>> musterr [CLI] bundle deployment auto-deploy get
        -Error: target dev has no auto-deploy trigger that you can view. To create one, run: databricks bundle deployment auto-deploy create -t dev
        +Deployment related commands for managing bundle resource bindings.
         
        -=== The target's trigger
        +Use these commands to bind / unbind bundle definitions to existing workspace resources.
         
        ->>> [CLI] bundle deployment auto-deploy get
        -Trigger ID: [UUID][0]
        -Repository: https://github.com/acme/repo
        -Bundle:     databricks.yml
        -Target:     dev
        -Branch:     main
        -Deploy as:  you or a user
        +Common workflow:
        +1. Generate configuration from existing resource:
        +   databricks bundle generate job --existing-job-id 12345 --key my_job
         
        ->>> [CLI] bundle deployment auto-deploy get -t prod
        -Trigger ID: [UUID][1]
        -Repository: https://github.com/acme/repo
        -Bundle:     databricks.yml
        -Target:     prod
        -Branch:     main
        -Deploy as:  [UUID][2]
        +2. Bind the bundle resource to the existing workspace resource:
        +   databricks bundle deployment bind my_job 12345
         
        ->>> [CLI] bundle deployment auto-deploy get -t prod -o json
        -{
        -  "name": "webhook-triggers/[UUID][1]",
        -  "repo_url": "https://github.com/acme/repo",
        -  "git_provider": "GITHUB",
        -  "trigger_config": {
        -    "push_event": {
        -      "branch": "main"
        -    },
        -    "dabs_deploy": {
        -      "bundle_yml_repo_path": "databricks.yml",
        -      "deployment_mode": "prod",
        -      "deploy_as": {
        -        "service_principal_client_id": "[UUID][2]"
        -      }
        -    },
        -    "trigger_id": "[UUID][1]"
        -  }
        -}
        -{
        -  "method": "GET",
        -  "path": "/api/2.0/git-webhooks/webhook-triggers",
        -  "q": {
        -    "filter": "repo_url = \"https://github.com/acme/repo\" AND trigger_config.dabs_deploy.bundle_yml_repo_path = \"databricks.yml\" AND trigger_config.dabs_deploy.deployment_mode = \"dev\""
        -  }
        -}
        -{
        -  "method": "GET",
        -  "path": "/api/2.0/git-webhooks/webhook-triggers",
        -  "q": {
        -    "filter": "repo_url = \"https://github.com/acme/repo\" AND trigger_config.dabs_deploy.bundle_yml_repo_path = \"databricks.yml\" AND trigger_config.dabs_deploy.deployment_mode = \"prod\""
        -  }
        -}
        -{
        -  "method": "GET",
        -  "path": "/api/2.0/git-webhooks/webhook-triggers",
        -  "q": {
        -    "filter": "repo_url = \"https://github.com/acme/repo\" AND trigger_config.dabs_deploy.bundle_yml_repo_path = \"databricks.yml\" AND trigger_config.dabs_deploy.deployment_mode = \"prod\"",
        -    "page_token": "1"
        -  }
        -}
        -{
        -  "method": "GET",
        -  "path": "/api/2.0/git-webhooks/webhook-triggers",
        -  "q": {
        -    "filter": "repo_url = \"https://github.com/acme/repo\" AND trigger_config.dabs_deploy.bundle_yml_repo_path = \"databricks.yml\" AND trigger_config.dabs_deploy.deployment_mode = \"prod\""
        -  }
        -}
        -{
        -  "method": "GET",
        -  "path": "/api/2.0/git-webhooks/webhook-triggers",
        -  "q": {
        -    "filter": "repo_url = \"https://github.com/acme/repo\" AND trigger_config.dabs_deploy.bundle_yml_repo_path = \"databricks.yml\" AND trigger_config.dabs_deploy.deployment_mode = \"prod\"",
        -    "page_token": "1"
        -  }
        -}
        +3. Deploy updates - the bound resource will be updated in the workspace:
        +   databricks bundle deploy
         
        -=== Another caller does not see the trigger
        +After binding, the existing workspace resource will be managed by your bundle.
         
        ->>> musterr as-test-sp [CLI] bundle deployment auto-deploy get
        -Error: target dev has no auto-deploy trigger that you can view. To create one, run: databricks bundle deployment auto-deploy create -t dev
        +Usage:
        +  databricks bundle deployment [command]
        +
        +Available Commands:
        +  bind        Bind bundle-defined resources to existing resources
        +  migrate     Migrate from Terraform to Direct deployment engine
        +  unbind      Unbind bundle-defined resources from its managed remote resource
        +
        +Flags:
        +  -h, --help[=true|false]   help for deployment
        +
        +Global Flags:
        +      --debug[=true|false]   enable debug logging
        +  -o, --output type          output type: text or json (default text)
        +  -p, --profile string       ~/.databrickscfg profile
        +  -t, --target string        bundle target to use (if applicable)
        +      --var strings          set values for variables defined in bundle config. Example: --var="foo=bar"
        +
        +Use "databricks bundle deployment [command] --help" for more information about a command.
        +
        +Unexpected success
        +
        +Exit code: 1

latest (v1.28.0): same output as main (4c4f104)

TestAccept/bundle/deployment/auto-deploy/list: branch ✅ | main (4c4f104) ❌ | latest (v1.28.0) ❌

main (4c4f104):

acceptance_test.go:1402: Diff:
        --- bundle/deployment/auto-deploy/list/output.txt
        +++ /tmp/TestAcceptbundledeploymentauto-deploylist3851503718/002/output.txt
        @@ -2,114 +2,41 @@
         === A bundle without triggers
         
         >>> [CLI] bundle deployment auto-deploy list
        -Target  Branch  Deploy as  Trigger ID
        +Deployment related commands for managing bundle resource bindings.
         
        -=== Another bundle in the same repository, whose trigger is not this bundle's
        +Use these commands to bind / unbind bundle definitions to existing workspace resources.
         
        ->>> withdir other [CLI] bundle deployment auto-deploy create
        -Pushes to branch main now deploy target dev as you.
        -Trigger ID: [UUID][0]
        -{
        -  "method": "PUT",
        -  "path": "/api/2.0/git-webhooks",
        -  "body": {
        -    "repo_url": "https://github.com/acme/repo",
        -    "git_provider": "GITHUB",
        -    "trigger_config": {
        -      "push_event": {
        -        "branch": "main"
        -      },
        -      "dabs_deploy": {
        -        "bundle_yml_repo_path": "other/databricks.yml",
        -        "deployment_mode": "dev"
        -      }
        -    }
        -  }
        -}
        +Common workflow:
        +1. Generate configuration from existing resource:
        +   databricks bundle generate job --existing-job-id 12345 --key my_job
         
        -=== The triggers of this bundle's targets
        +2. Bind the bundle resource to the existing workspace resource:
        +   databricks bundle deployment bind my_job 12345
         
        ->>> [CLI] bundle deployment auto-deploy list
        -Target  Branch  Deploy as      Trigger ID
        -dev     main    you or a user  [UUID][1]
        -prod    main    you or a user  [UUID][2]
        +3. Deploy updates - the bound resource will be updated in the workspace:
        +   databricks bundle deploy
         
        ->>> [CLI] bundle deployment auto-deploy list -o json
        -[
        -  {
        -    "name": "webhook-triggers/[UUID][1]",
        -    "repo_url": "https://github.com/acme/repo",
        -    "git_provider": "GITHUB",
        -    "trigger_config": {
        -      "push_event": {
        -        "branch": "main"
        -      },
        -      "dabs_deploy": {
        -        "bundle_yml_repo_path": "databricks.yml",
        -        "deployment_mode": "dev"
        -      },
        -      "trigger_id": "[UUID][1]"
        -    }
        -  },
        -  {
        -    "name": "webhook-triggers/[UUID][2]",
        -    "repo_url": "https://github.com/acme/repo",
        -    "git_provider": "GITHUB",
        -    "trigger_config": {
        -      "push_event": {
        -        "branch": "main"
        -      },
        -      "dabs_deploy": {
        -        "bundle_yml_repo_path": "databricks.yml",
        -        "deployment_mode": "prod"
        -      },
        -      "trigger_id": "[UUID][2]"
        -    }
        -  }
        -]
        -{
        -  "method": "GET",
        -  "path": "/api/2.0/git-webhooks/webhook-triggers",
        -  "q": {
        -    "filter": "repo_url = \"https://github.com/acme/repo\" AND trigger_config.dabs_deploy.bundle_yml_repo_path = \"databricks.yml\""
        -  }
        -}
        -{
        -  "method": "GET",
        -  "path": "/api/2.0/git-webhooks/webhook-triggers",
        -  "q": {
        -    "filter": "repo_url = \"https://github.com/acme/repo\" AND trigger_config.dabs_deploy.bundle_yml_repo_path = \"databricks.yml\"",
        -    "page_token": "1"
        -  }
        -}
        -{
        -  "method": "GET",
        -  "path": "/api/2.0/git-webhooks/webhook-triggers",
        -  "q": {
        -    "filter": "repo_url = \"https://github.com/acme/repo\" AND trigger_config.dabs_deploy.bundle_yml_repo_path = \"databricks.yml\"",
        -    "page_token": "2"
        -  }
        -}
        -{
        -  "method": "GET",
        -  "path": "/api/2.0/git-webhooks/webhook-triggers",
        -  "q": {
        -    "filter": "repo_url = \"https://github.com/acme/repo\" AND trigger_config.dabs_deploy.bundle_yml_repo_path = \"databricks.yml\""
        -  }
        -}
        -{
        -  "method": "GET",
        -  "path": "/api/2.0/git-webhooks/webhook-triggers",
        -  "q": {
        -    "filter": "repo_url = \"https://github.com/acme/repo\" AND trigger_config.dabs_deploy.bundle_yml_repo_path = \"databricks.yml\"",
        -    "page_token": "1"
        -  }
        -}
        -{
        -  "method": "GET",
        -  "path": "/api/2.0/git-webhooks/webhook-triggers",
        -  "q": {
        -    "filter": "repo_url = \"https://github.com/acme/repo\" AND trigger_config.dabs_deploy.bundle_yml_repo_path = \"databricks.yml\"",
        -    "page_token": "2"
        -  }
        -}
        +After binding, the existing workspace resource will be managed by your bundle.
        +
        +Usage:
        +  databricks bundle deployment [command]
        +
        +Available Commands:
        +  bind        Bind bundle-defined resources to existing resources
        +  migrate     Migrate from Terraform to Direct deployment engine
        +  unbind      Unbind bundle-defined resources from its managed remote resource
        +
        +Flags:
        +  -h, --help[=true|false]   help for deployment
        +
        +Global Flags:
        +      --debug[=true|false]   enable debug logging
        +  -o, --output type          output type: text or json (default text)
        +  -p, --profile string       ~/.databrickscfg profile
        +  -t, --target string        bundle target to use (if applicable)
        +      --var strings          set values for variables defined in bundle config. Example: --var="foo=bar"
        +
        +Use "databricks bundle deployment [command] --help" for more information about a command.
        +rm: cannot remove '[OUTPUT_DIR]/out.requests.txt': No such file or directory
        +
        +Exit code: 1
        
    acceptance_test.go:1180: 
        LOG.setup: Deployment related commands for managing bundle resource bindings.
        LOG.setup: 
        LOG.setup: Use these commands to bind / unbind bundle definitions to existing workspace resources.
        LOG.setup: 
        LOG.setup: Common workflow:
        LOG.setup: 1. Generate configuration from existing resource:
        LOG.setup:    databricks bundle generate job --existing-job-id 12345 --key my_job
        LOG.setup: 
        LOG.setup: 2. Bind the bundle resource to the existing workspace resource:
        LOG.setup:    databricks bundle deployment bind my_job 12345
        LOG.setup: 
        LOG.setup: 3. Deploy updates - the bound resource will be updated in the workspace:
        LOG.setup:    databricks bundle deploy
        LOG.setup: 
        LOG.setup: After binding, the existing workspace resource will be managed by your bundle.
        LOG.setup: 
        LOG.setup: Usage:
        LOG.setup:   databricks bundle deployment [command]
        LOG.setup: 
        LOG.setup: Available Commands:
        LOG.setup:   bind        Bind bundle-defined resources to existing resources
        LOG.setup:   migrate     Migrate from Terraform to Direct deployment engine
        LOG.setup:   unbind      Unbind bundle-defined resources from its managed remote resource
        LOG.setup: 
        LOG.setup: Flags:
        LOG.setup:   -h, --help[=true|false]   help for deployment
        LOG.setup: 
        LOG.setup: Global Flags:
        LOG.setup:       --debug[=true|false]   enable debug logging
        LOG.setup:   -o, --output type          output type: text or json (default text)
        LOG.setup:   -p, --profile string       ~/.databrickscfg profile
        LOG.setup:   -t, --target string        bundle target to use (if applicable)
        LOG.setup:       --var strings          set values for variables defined in bundle config. Example: --var="foo=bar"
        LOG.setup: 
        LOG.setup: Use "databricks bundle deployment [command] --help" for more information about a command.
        LOG.setup: Deployment related commands for managing bundle resource bindings.
        LOG.setup: 
        LOG.setup: Use these commands to bind / unbind bundle definitions to existing workspace resources.
        LOG.setup: 
        LOG.setup: Common workflow:
        LOG.setup: 1. Generate configuration from existing resource:
        LOG.setup:    databricks bundle generate job --existing-job-id 12345 --key my_job
        LOG.setup: 
        LOG.setup: 2. Bind the bundle resource to the existing workspace resource:
        LOG.setup:    databricks bundle deployment bind my_job 12345
        LOG.setup: 
        LOG.setup: 3. Deploy updates - the bound resource will be updated in the workspace:
... (24 more lines truncated, raise DATABRICKS_CLI_TEST_MAX_LOG to see more)

latest (v1.28.0): same output as main (4c4f104)

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: 0a1d5c6

Run: 46397283991

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 173 22 4:01
💚​ aws-windows-latest-4core-16gb 1 173 22 1:23
💚​ azure linux-2core-8gb 1 172 22 4:05
💚​ azure-windows-latest-4core-16gb 1 172 22 1:35
💚​ gcp linux-2core-8gb 1 173 22 3:41
💚​ gcp-windows-latest-4core-16gb 1 173 22 2:04
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 3 slowest tests (at least 2 minutes):
duration env testname
4:01 aws linux-2core-8gb TestAccept
3:59 azure linux-2core-8gb TestAccept
3:41 gcp linux-2core-8gb TestAccept

@denik denik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 Automated review of 5bfec4a by Opus and two independent GPT-6 Astra passes (Fable was unavailable for this round); each finding verified against the code.

No blocking issues. One should-fix is inline: the status column's colors misalign the list. The other points below are smaller. Built and tested merged onto current main: the auto-deploy acceptance tests and the touched packages pass.

Review points:

  • Stacked on #8187. This round covers only this PR's diff against dabs-ad-d4-dep-pr5-delete.
  • +1 to review-oss-bot's point on . and ..: against the fake, attempts . already resolves to the list route, decodes into an empty attempt and prints blank Attempt ID:/Status: with exit 0.

Other findings, ranked (not posted inline):

  1. Should fix (plausible) cmd/bundle/deployment/autodeploy/attempts.go:59: there is no --limit, and attempts grow by one per push. attempts -o json | jq '.[0]' (or any non-paged run) fetches the trigger's whole history, one request per page. cmdio.WithLimit is what the generated list commands use (e.g. jobs list).
  2. Maintainability libs/testserver/fake_workspace.go:334: GitWebhookAttempts keeps a deleted trigger's attempts, but both readers return 404 for a missing trigger and a re-created trigger gets a new ID, so nothing can reach them. Holding the attempts on fakeWebhookTrigger drops the new FakeWorkspace field, its initializer and the import, and delete cleans them up for free.

"github.com/spf13/cobra"
)

const attemptStatusTemplate = `{{$s := replace .AttemptStatus "ATTEMPT_STATUS_" ""}}{{if eq $s "SUCCEEDED"}}{{green "%s" $s}}{{else if eq $s "FAILED"}}{{red "%s" $s}}{{else}}{{$s}}{{end}}`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 Should fix: only SUCCEEDED and FAILED get a color here; QUEUED, RUNNING and UNKNOWN stay plain. Status is a middle column, and the list goes through text/tabwriter (libs/cmdio/render.go:400, flags 0), which counts the ANSI escape bytes as width. When color is on but the pager isn't (stdout is a terminal, stdin or stderr isn't: attempts 2>/dev/null, attempts </dev/null), the plain rows get 9 extra spaces of padding and the Commit and Created columns stop lining up (rendered through RenderIterator with this template, escapes stripped):

aaaaaaaa-0000        RUNNING             0123456789ab     2026-11-24T10:03:00Z
bbbbbbbb-0000        SUCCEEDED  0123456789ab     2026-11-24T10:02:00Z

Coloring every branch, the way the cluster list's state column does (cmd/workspace/clusters/overrides.go:17, {{else}}{{blue "%s" .State}}), keeps the widths equal. The single-attempt view isn't affected, since it has no columns.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 0a1d5c6. QUEUED, RUNNING and UNKNOWN are now blue, as in the clusters list, so every status carries the same escape bytes. #7943 has the same fix.

`attempts` lists the auto-deploy attempts of the bundle target, newest first,
or shows one attempt when given its ID. It finds the target's trigger, then
calls ListAutoDeployAttempts or GetAutoDeployAttempt.

The fake queues an attempt when a trigger is created, as the service deploys
the branch's head right away. It has no runner, so the test stubs a failed
attempt to cover how one renders.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: atreyadbrx <atreya.misra@databricks.com>
@atreyadbrx
atreyadbrx force-pushed the dabs-ad-d4-dep-pr6-attempts branch from 5bfec4a to 0a1d5c6 Compare November 30, 2026 10:07
@atreyadbrx
atreyadbrx force-pushed the dabs-ad-d4-dep-pr5-delete branch from 67111f8 to 0333648 Compare November 30, 2026 10:07
@atreyadbrx

Copy link
Copy Markdown
Contributor Author

Thanks @denik. The other points:

  • . and ..: rejected now, like an ID with /. The test covers ...
  • Attempts in the fake: they now live on fakeWebhookTrigger. The FakeWorkspace field, its initializer and the import are gone. A delete drops a trigger's attempts, and an update keeps them.
  • --limit: a new flag goes through DECO review, so I've left it out for now. @pietern, should attempts get a --limit like jobs list has?

The same changes are in #7943.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants