Repository navigation
Add bundle deployment auto-deploy get and list - #8186
atreyadbrx wants to merge 1 commit into
Conversation
Regression test report ✅Commit: Selected 3 changed tests (limit=20, 0 not selected) 3 tests: regression=3 unreleased=0 coverage=0 failing=0
TestAccept/bundle/deployment/auto-deploy/create: branch ✅ | main (4c4f104) ❌ | latest (v1.28.0) ❌main (4c4f104): latest (v1.28.0): same output as main (4c4f104) TestAccept/bundle/deployment/auto-deploy/get: branch ✅ | main (4c4f104) ❌ | latest (v1.28.0) ❌main (4c4f104): latest (v1.28.0): same output as main (4c4f104) TestAccept/bundle/deployment/auto-deploy/list: branch ✅ | main (4c4f104) ❌ | latest (v1.28.0) ❌main (4c4f104): latest (v1.28.0): same output as main (4c4f104) |
There was a problem hiding this comment.
Automated review at 77d4c74. Each finding was verified against the code.
No blocking issues found. 2 non-blocking comment(s) below.
This PR adds bundle deployment auto-deploy get and list. Both use ListWebhookTriggers with an AIP-160 filter, and the PR adds a paging fake that filters by creator to test them. The listing and lookup paths look right. Two things are worth fixing before merge, neither blocking: the "you or a user" text in the Deploy as field, and the unquoted values in the suggested create command, which also has no test for the -p case.
|
|
||
| // The service shows deploy_as only for a service principal other than the caller, so an unset | ||
| // value is the caller or a user, which an admin's update can make someone other than the creator. | ||
| const deployAsTemplate = `{{with .TriggerConfig.DabsDeploy.DeployAs}}{{.ServicePrincipalClientID}}{{else}}you or a user{{end}}` |
There was a problem hiding this comment.
[nice to have] When an admin runs list (or get) on triggers that other users created without --deploy-as, every row reads "you or a user", even though the deploys don't run as the admin. It also disagrees with create, which prints "as you" for the same trigger, and with the PR description, which says "its creator". Can we pick one wording that is true when the service omits deploy_as (for example "a user (not shown)") and use it in create's message too? Also, the template renders only ServicePrincipalClientID. If a response ever sets user_email, with takes that branch and the field prints empty, so {{or .ServicePrincipalClientID .UserEmail}} would cost little.
|
|
||
| // createCommand is the command that creates the trigger of the bundle's target. | ||
| func (t trigger) createCommand() string { | ||
| command := "databricks bundle deployment auto-deploy create -t " + t.target |
There was a problem hiding this comment.
[nice to have] get -p 'production workspace' on a target with no trigger suggests ... create -t dev -p production workspace. Pasting that splits the profile into two arguments, so create fails. Shell characters in a target or profile name would change what the command does. getCommonArgs in cmd/bundle/deployment/migrate.go already quotes these flags with shellquote.BashArg. Can we do the same here, and add a get -p <profile> case to the get acceptance test? Right now nothing covers the -p part of this hint.
✅ Integration test reportCommit: 86128aa
Top 3 slowest tests (at least 2 minutes):
|
`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>
31284b0 to
6568c9d
Compare
77d4c74 to
86128aa
Compare
This is #7941 under
bundle deployment.Changes
getshows the trigger of the bundle target.listlists the triggers of all the bundle's targets.ListWebhookTriggerswith an AIP-160 filter on the repo URL and bundle path, plus the target forget.getstops at the first match, since the service keeps one trigger per target. Its "no trigger" error suggests thecreatecommand, including-pwhen it was passed. Both support text and-o jsonoutput.listcovers the selected target's origin and workspace, as its help says.\"/\\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 returnsdeploy_asonly for a service principal, so an unset value shows as "its creator".Tests
acceptance/bundle/deployment/auto-deploy/get: a target with no trigger, text output, and-o json.acceptance/bundle/deployment/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.get,listand their-o jsonread the service's responses as expected, including theGITHUBenum,deploy_asfor a service principal, and the "no trigger" error.Stacked on #8185.
This pull request and its description were written by Isaac.