Skip to content

Add bundle auto-deploy get and list - #7941

Open
atreyadbrx wants to merge 1 commit into
dabs-ad-d4-pr3-createfrom
dabs-ad-d4-pr4-get-list
Open

atreyadbrx wants to merge 1 commit into
dabs-ad-d4-pr3-createfrom
dabs-ad-d4-pr4-get-list

Conversation

@atreyadbrx

@atreyadbrx atreyadbrx commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Changes

  • get shows the trigger of the bundle target. list lists the triggers of all the bundle's targets.
  • Both call ListWebhookTriggers with an AIP-160 filter on the repo URL and bundle path, plus the target for get. get stops at the first match, since the service keeps one trigger per target. Its "no trigger" error suggests the create command, including -p when it was passed. Both support text and -o json output. list covers the selected target's origin and workspace, as its help says.
  • The fake list handler follows the service: it pages over all triggers, returns the matches on each page, and lists only the caller's triggers. It parses only the quoted values and \"/\\ escapes the service takes, and rejects a repeated field and a bad page token.

Why

Users need to see what auto-deploy is set up for a bundle. The service keeps at most one trigger per repository and target, so a target filter is enough for get. The service returns deploy_as only for a service principal, so an unset value shows as "its creator".

Tests

  • acceptance/bundle/auto-deploy/get: a target with no trigger, text output, and -o json.
  • acceptance/bundle/auto-deploy/list: two targets, plus another bundle in the same repo whose trigger is left out. The fake's one-item pages exercise the client's paging.
  • Unit test for filter-string quoting.

Stacked on #7940.

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 bbaf04d. Each finding was verified against the code.

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

This PR adds bundle auto-deploy get and list. Both call ListWebhookTriggers with an AIP-160 filter, and the fake server learns to handle that filter and to return one trigger per page. The paging and filter code look correct. Two things need fixing: list is still tied to the one selected target, which doesn't match its help text, and the "Deploy as" rendering and its comments disagree with what create --deploy-as accepts. A smaller point: the fake filter parser has a fallback for unquoted values that it shouldn't need.


cmd.RunE = func(cmd *cobra.Command, args []string) error {
t, api, err := loadTrigger(cmd)
if err != nil {

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] list says it covers "this bundle's targets", but loadTrigger runs ProcessBundle, which selects one target first. In a bundle with two targets and no default: true, bundle auto-deploy list fails with "please specify target" even though the filter never uses the target. When prod sets its own workspace.host, running list from dev only queries dev's workspace and leaves out prod's trigger without saying so. The same happens when a target overrides bundle.git.origin_url, because repo_url comes from the selected target (trigger.go resolveTrigger). Should list work without a selected target, or go through each target's workspace and origin? Failing that, can the help text say it lists the triggers in the selected target's workspace and repository?

Comment thread cmd/bundle/autodeploy/get.go Outdated

// The service shows deploy_as only for a service principal. A trigger can only deploy as a
// service principal or the user who set it up.
const deployAsTemplate = `{{with .TriggerConfig.DabsDeploy.DeployAs}}{{or .UserEmail .ServicePrincipalClientID}}{{else}}its creator{{end}}`

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] create --deploy-as alice@example.com sends DeployAs{UserEmail: ...} (deployAsIdentity in create.go), and its help says it takes a user's email. The comment here and the one in libs/gitwebhooks/model.go say the service returns deploy_as only for a service principal, and that an unset value means the creator. If both are true, a trigger that bob created to deploy as alice shows "its creator" in get and list, which reads as bob. And {{or .UserEmail ...}} is a branch the comment says never runs. Which is it? If the service drops user_email, the unset case can't honestly read "its creator", and the .UserEmail branch should go. If the service keeps it, the comments here and in model.go need fixing. The fake's list handler returns user_email too, so the goldens can't tell the two cases apart.

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 +1. The current wording is still wrong after someone else updates the trigger: an update keeps the trigger's creator but makes it deploy as the caller. Scenario: user U runs auto-deploy create -t prod, then a workspace admin A runs the same command (admins can update any trigger). The trigger now deploys as A, but get and list print Deploy as: its creator, which reads as U. The same happens when U creates it with --deploy-as <SP> and that service principal runs get, since deploy_as is left out when it is the caller.

Since deploy_as comes back only for a service principal other than the caller, an unset value can only honestly say that it isn't one, e.g. you or a user or a user (not shown). The comment on DabsDeployTarget.DeployAs (libs/gitwebhooks/model.go:72) makes the same claim.

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.

Changed in ee80a9e to you or a user. The model comment now says deploy_as is set only for a service principal other than the caller. The get test also renders the service-principal case as text now.

Comment thread libs/testserver/gitwebhooks.go Outdated
if _, ok := gitWebhookFilterFields[field]; !ok {
return nil, fmt.Errorf("unsupported filter field: %s", field)
}
if strings.HasPrefix(value, `"`) {

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 parser's doc comment says the supported subset takes string values in double quotes, but when a value doesn't start with ", this branch silently matches on the raw text. So repo_url = https://github.com/acme/repo succeeds in the fake. If a later change dropped quote() from the client, every acceptance test would still pass. That's the kind of just-in-case fallback AGENTS.md asks us not to add, and testing.md wants the fake to model the real contract. Can this return INVALID_PARAMETER_VALUE for an unquoted value instead?

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Regression test report ✅

Commit: b78dec40b | Workflow run

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

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

main (4c4f104):

acceptance_test.go:1402: Diff:
        --- bundle/auto-deploy/create/output.txt
        +++ /tmp/TestAcceptbundleauto-deploycreate2118182651/002/output.txt
        @@ -2,289 +2,48 @@
         === The current branch, as the caller
         
         >>> [CLI] bundle 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"
        -      }
        -    }
        -  }
        -}
        +Declarative Automation Bundles let you express data/AI/analytics projects as code.
         
        -=== Updating the trigger keeps its ID
        +Common workflows:
        +  databricks bundle init default-python      # Initialize new project
        +  databricks bundle deploy --target dev      # Deploy to development
        +  databricks bundle run my_job               # Run jobs/pipelines
        +  databricks bundle deploy --target prod     # Deploy to production
         
        ->>> [CLI] bundle 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]"
        -        }
        -      }
        -    }
        -  }
        -}
        +Import existing resources:
        +  databricks bundle generate job --existing-job-id 123 --key my_job # Generate job configuration
        +  databricks bundle deployment bind my_job 123                      # Link to an existing job
         
        -=== As yourself, in JSON
        +Online documentation: https://docs.databricks.com/en/dev-tools/bundles/index.html
         
        ->>> [CLI] bundle 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]"
        -        }
        -      }
        -    }
        -  }
        -}
        +Usage:
        +  databricks bundle [command]
         
        -=== As a service principal, on a production target that a user could not deploy
        +Available Commands:
        +  deploy             Deploy bundle
        +  deployment         Deployment related commands
        +  destroy            Destroy deployed bundle resources
        +  generate           Generate bundle configuration
        +  init               Initialize using a bundle template
        +  open               Open a resource in the browser
        +  plan               Show deployment plan
        +  run                Run a job, pipeline update or app
        +  schema             Generate JSON Schema for bundle configuration
        +  summary            Summarize resources deployed by this bundle
        +  sync               Synchronize bundle tree to the workspace
        +  validate           Validate configuration
         
        ->>> [CLI] bundle 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]"
        -        }
        -      }
        -    }
        -  }
        -}
        +Flags:
        +  -h, --help[=true|false]   help for bundle
        +      --var strings         set values for variables defined in bundle config. Example: --var="foo=bar"
         
        -=== As another user
        +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)
         
        ->>> musterr [CLI] bundle 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.
        +Use "databricks bundle [command] --help" for more information about a command.
        +File [OUTPUT_DIR]/out.requests.txt not found
         
        -Host:      [DATABRICKS_URL]
        -Auth type: Personal Access Token (pat)
        -
        -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"
        -        }
        -      }
        -    }
        -  }
        -}
        -
        -=== A branch other than the target's git.branch
        -
        ->>> musterr [CLI] bundle 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 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"
        -      }
        -    }
... (129 more lines truncated, raise DATABRICKS_CLI_TEST_MAX_LOG to see more)

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

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

main (4c4f104):

acceptance_test.go:1402: Diff:
        --- bundle/auto-deploy/get/output.txt
        +++ /tmp/TestAcceptbundleauto-deployget3813398534/002/output.txt
        @@ -2,84 +2,49 @@
         === A target without a trigger
         
         >>> musterr [CLI] bundle auto-deploy get
        -Error: target dev has no auto-deploy trigger that you can view. To create one, run: databricks bundle auto-deploy create -t dev
        +Declarative Automation Bundles let you express data/AI/analytics projects as code.
         
        -=== The target's trigger
        +Common workflows:
        +  databricks bundle init default-python      # Initialize new project
        +  databricks bundle deploy --target dev      # Deploy to development
        +  databricks bundle run my_job               # Run jobs/pipelines
        +  databricks bundle deploy --target prod     # Deploy to production
         
        ->>> [CLI] bundle 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
        +Import existing resources:
        +  databricks bundle generate job --existing-job-id 123 --key my_job # Generate job configuration
        +  databricks bundle deployment bind my_job 123                      # Link to an existing job
         
        ->>> [CLI] bundle 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]
        +Online documentation: https://docs.databricks.com/en/dev-tools/bundles/index.html
         
        ->>> [CLI] bundle 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"
        -  }
        -}
        +Usage:
        +  databricks bundle [command]
         
        -=== Another caller does not see the trigger
        +Available Commands:
        +  deploy             Deploy bundle
        +  deployment         Deployment related commands
        +  destroy            Destroy deployed bundle resources
        +  generate           Generate bundle configuration
        +  init               Initialize using a bundle template
        +  open               Open a resource in the browser
        +  plan               Show deployment plan
        +  run                Run a job, pipeline update or app
        +  schema             Generate JSON Schema for bundle configuration
        +  summary            Summarize resources deployed by this bundle
        +  sync               Synchronize bundle tree to the workspace
        +  validate           Validate configuration
         
        ->>> musterr as-test-sp [CLI] bundle auto-deploy get
        -Error: target dev has no auto-deploy trigger that you can view. To create one, run: databricks bundle auto-deploy create -t dev
        +Flags:
        +  -h, --help[=true|false]   help for bundle
        +      --var strings         set values for variables defined in bundle config. Example: --var="foo=bar"
        +
        +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)
        +
        +Use "databricks bundle [command] --help" for more information about a command.
        +
        +Unexpected success
        +
        +Exit code: 1
        
FAIL

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

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

main (4c4f104):

acceptance_test.go:1402: Diff:
        --- bundle/auto-deploy/list/output.txt
        +++ /tmp/TestAcceptbundleauto-deploylist3609015463/002/output.txt
        @@ -2,114 +2,48 @@
         === A bundle without triggers
         
         >>> [CLI] bundle auto-deploy list
        -Target  Branch  Deploy as  Trigger ID
        +Declarative Automation Bundles let you express data/AI/analytics projects as code.
         
        -=== Another bundle in the same repository, whose trigger is not this bundle's
        +Common workflows:
        +  databricks bundle init default-python      # Initialize new project
        +  databricks bundle deploy --target dev      # Deploy to development
        +  databricks bundle run my_job               # Run jobs/pipelines
        +  databricks bundle deploy --target prod     # Deploy to production
         
        ->>> withdir other [CLI] bundle 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"
        -      }
        -    }
        -  }
        -}
        +Import existing resources:
        +  databricks bundle generate job --existing-job-id 123 --key my_job # Generate job configuration
        +  databricks bundle deployment bind my_job 123                      # Link to an existing job
         
        -=== The triggers of this bundle's targets
        +Online documentation: https://docs.databricks.com/en/dev-tools/bundles/index.html
         
        ->>> [CLI] bundle 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]
        +Usage:
        +  databricks bundle [command]
         
        ->>> [CLI] bundle 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"
        -  }
        -}
        +Available Commands:
        +  deploy             Deploy bundle
        +  deployment         Deployment related commands
        +  destroy            Destroy deployed bundle resources
        +  generate           Generate bundle configuration
        +  init               Initialize using a bundle template
        +  open               Open a resource in the browser
        +  plan               Show deployment plan
        +  run                Run a job, pipeline update or app
        +  schema             Generate JSON Schema for bundle configuration
        +  summary            Summarize resources deployed by this bundle
        +  sync               Synchronize bundle tree to the workspace
        +  validate           Validate configuration
        +
        +Flags:
        +  -h, --help[=true|false]   help for bundle
        +      --var strings         set values for variables defined in bundle config. Example: --var="foo=bar"
        +
        +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)
        +
        +Use "databricks bundle [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: Declarative Automation Bundles let you express data/AI/analytics projects as code.
        LOG.setup: 
        LOG.setup: Common workflows:
        LOG.setup:   databricks bundle init default-python      # Initialize new project
        LOG.setup:   databricks bundle deploy --target dev      # Deploy to development
        LOG.setup:   databricks bundle run my_job               # Run jobs/pipelines
        LOG.setup:   databricks bundle deploy --target prod     # Deploy to production
        LOG.setup: 
        LOG.setup: Import existing resources:
        LOG.setup:   databricks bundle generate job --existing-job-id 123 --key my_job # Generate job configuration
        LOG.setup:   databricks bundle deployment bind my_job 123                      # Link to an existing job
        LOG.setup: 
        LOG.setup: Online documentation: https://docs.databricks.com/en/dev-tools/bundles/index.html
        LOG.setup: 
        LOG.setup: Usage:
        LOG.setup:   databricks bundle [command]
        LOG.setup: 
        LOG.setup: Available Commands:
        LOG.setup:   deploy             Deploy bundle
        LOG.setup:   deployment         Deployment related commands
        LOG.setup:   destroy            Destroy deployed bundle resources
        LOG.setup:   generate           Generate bundle configuration
        LOG.setup:   init               Initialize using a bundle template
        LOG.setup:   open               Open a resource in the browser
        LOG.setup:   plan               Show deployment plan
        LOG.setup:   run                Run a job, pipeline update or app
        LOG.setup:   schema             Generate JSON Schema for bundle configuration
        LOG.setup:   summary            Summarize resources deployed by this bundle
        LOG.setup:   sync               Synchronize bundle tree to the workspace
        LOG.setup:   validate           Validate configuration
        LOG.setup: 
        LOG.setup: Flags:
        LOG.setup:   -h, --help[=true|false]   help for bundle
        LOG.setup:       --var strings         set values for variables defined in bundle config. Example: --var="foo=bar"
        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)
... (44 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 24, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: b78dec4

Run: 46397340333

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 173 20 4:08
💚​ aws-windows-latest-4core-16gb 1 173 20 1:26
💚​ azure linux-2core-8gb 1 172 20 4:00
💚​ azure-windows-latest-4core-16gb 1 172 20 1:32
💚​ gcp linux-2core-8gb 1 173 20 4:11
💚​ gcp-windows-latest-4core-16gb 1 173 20 2:21
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:10 gcp linux-2core-8gb TestAccept
4:08 aws linux-2core-8gb TestAccept
3:56 azure linux-2core-8gb TestAccept

@atreyadbrx
atreyadbrx force-pushed the dabs-ad-d4-pr3-create branch from cd55ba9 to cf6b8e1 Compare November 24, 2026 18:59
@atreyadbrx
atreyadbrx force-pushed the dabs-ad-d4-pr4-get-list branch from bbaf04d to eb8b631 Compare November 24, 2026 18:59
@atreyadbrx
atreyadbrx force-pushed the dabs-ad-d4-pr3-create branch from cf6b8e1 to cfcecee Compare November 27, 2026 16:57
@atreyadbrx
atreyadbrx force-pushed the dabs-ad-d4-pr4-get-list branch from eb8b631 to 852eda8 Compare November 27, 2026 16:57

@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 852eda8 by Opus, Fable and Astra; each finding verified against the code.

No blocking issues. Two should-fix points: one inline, one as a reply in review-oss-bot's deploy-as thread. I reviewed only this PR's diff against dabs-ad-d4-pr3-create (stacked on #7940). The auto-deploy acceptance and unit tests pass at this head, and also with it merged into current main.

Review points:

  • review-oss-bot's three threads from bbaf04d are still open. The new help text looks like it covers the list scope thread. The unquoted-value thread is mostly addressed: only git_provider still takes a bare value (item 1 below).
  • No cloud run is possible because test workspaces don't serve the git-webhooks API yet. Until then, the list path, filter field names and escaping are pinned only by the fake.

Not posted inline:

  1. Should fix libs/testserver/gitwebhooks.go:115: the fake differs from the list endpoint in ways that let tests pass for the wrong reason:

    • It filters before paging, so it never returns a page with the match plus a next_page_token. That hides the findTrigger paging issue.
    • It returns every trigger to every caller, so no test can reach the "that you can view" error. An as-test-sp step could cover it.
    • Its parser splits on AND before reading quotes, so a bundle under R AND D/ gets a 400.
    • It decodes values with strconv.Unquote, which also accepts \n, \t and \x41. Replacing quote() with strconv.Quote would still pass.
    • A repeated field is last-wins instead of an error.
    • The CLI never sends git_provider.
    • A negative page_token panics at matched[offset:end].
  2. Should fix acceptance/bundle/auto-deploy/get/script:13, list/script:10: two paths are never pinned:

    • The service-principal branch of deployAsTemplate never renders as text: the SP trigger is read only with -o json.
    • The other/ exclusion would still pass if create in other/ resolved to the root databricks.yml, because its request is deleted before printing.

    Rendering get -t prod as text, and printing the other create's request (or running list in other/), would pin both.

  3. Should fix (minor) cmd/bundle/autodeploy/trigger.go:97: the "To create one, run: ..." hint drops an explicit -p. For a bundle without workspace.host, get -p staging -t prod suggests a command that creates the trigger, and immediately deploys, in the default profile's workspace. cmd/workspace/apps/errors.go:53 adds --profile to its suggested command.

Comment thread cmd/bundle/autodeploy/trigger.go Outdated

// findTrigger returns the trigger of the bundle's target, or an error if it has none.
func findTrigger(ctx context.Context, api *gitwebhooks.API, t trigger) (*gitwebhooks.WebhookTrigger, error) {
triggers, err := listing.ToSlice(ctx, api.ListWebhookTriggers(ctx, gitwebhooks.ListWebhookTriggersRequest{Filter: t.targetFilter()}))

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 listing.ToSlice keeps paging after the one match get needs. The list endpoint pages over all of the repository's triggers and returns the matches of each page, so in a repository with more triggers than one page holds, the page with the match still carries a next_page_token. get then sends more GETs whose results it can't use (each one an extra round trip), and a 429/5xx on one of them fails get with the answer already in hand.

Taking the first item avoids both; the iterator already skips empty pages that carry a token:

found, err := api.ListWebhookTriggers(ctx, gitwebhooks.ListWebhookTriggersRequest{Filter: t.targetFilter()}).Next(ctx)
if errors.Is(err, listing.ErrNoMoreItems) {
	return nil, fmt.Errorf("target %s has no auto-deploy trigger ...", ...)
}

listing.ToSliceN(ctx, it, 1) doesn't help: its loop calls HasNext (which fetches the next page) before checking the count. The fake filters before paging, so it never returns such a page, and the golden shows one request per get.

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 ee80a9e. findTrigger now takes the first item with Next. The fake pages over all of the repository's triggers, as the service does, so get -t prod in the get test reads two pages and stops at the match.

Comment thread cmd/bundle/autodeploy/get.go Outdated

// The service shows deploy_as only for a service principal. A trigger can only deploy as a
// service principal or the user who set it up.
const deployAsTemplate = `{{with .TriggerConfig.DabsDeploy.DeployAs}}{{or .UserEmail .ServicePrincipalClientID}}{{else}}its creator{{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 +1. The current wording is still wrong after someone else updates the trigger: an update keeps the trigger's creator but makes it deploy as the caller. Scenario: user U runs auto-deploy create -t prod, then a workspace admin A runs the same command (admins can update any trigger). The trigger now deploys as A, but get and list print Deploy as: its creator, which reads as U. The same happens when U creates it with --deploy-as <SP> and that service principal runs get, since deploy_as is left out when it is the caller.

Since deploy_as comes back only for a service principal other than the caller, an unset value can only honestly say that it isn't one, e.g. you or a user or a user (not shown). The comment on DabsDeployTarget.DeployAs (libs/gitwebhooks/model.go:72) makes the same claim.

@denik
denik requested review from a team November 29, 2026 09:17
@atreyadbrx
atreyadbrx force-pushed the dabs-ad-d4-pr3-create branch from cfcecee to 30d20e7 Compare November 29, 2026 22:25
@atreyadbrx
atreyadbrx force-pushed the dabs-ad-d4-pr4-get-list branch from 852eda8 to ee80a9e Compare November 29, 2026 22:25
@atreyadbrx

Copy link
Copy Markdown
Contributor Author

Thanks @denik. I pushed ee80a9e with your points addressed. Inline threads have replies.

  • Fake list handler:
    • It pages over all triggers and returns the matches on each page.
    • It lists only the caller's triggers, so get as another caller now fails with "that you can view".
    • It parses quoted values with only the \" and \\ escapes, so R AND D/ works.
    • It rejects a repeated field and a bad page token.
    • git_provider is gone, since the CLI doesn't send it.
    • Unit test in libs/testserver/gitwebhooks_test.go.
  • Tests: get -t prod now renders the service-principal case as text, and the list test prints the other/ create request, which shows other/databricks.yml.
  • Hint: "To create one, run" now includes -p when it was passed.
  • Earlier review-bot threads: the help text covers the list scope, and the quoted-values thread is now fully addressed.

`get` shows the trigger of the bundle target and `list` lists the triggers of
all the bundle's targets. Both call ListWebhookTriggers, filtered on the
bundle's repository and path, plus the target for `get`.

The fake list handler supports the filter fields the CLI sends and returns
one trigger per page, so the CLI's paging is exercised.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: atreyadbrx <atreya.misra@databricks.com>
@atreyadbrx
atreyadbrx force-pushed the dabs-ad-d4-pr3-create branch from 30d20e7 to b8e3fd8 Compare November 30, 2026 10:07
@atreyadbrx
atreyadbrx force-pushed the dabs-ad-d4-pr4-get-list branch from ee80a9e to b78dec4 Compare November 30, 2026 10:07

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