Repository navigation
Add bundle deployment auto-deploy attempts - #8188
atreyadbrx wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
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.EncodeMultiSegmentPathParameterleaves dots unescaped, soattempts ..sendsGET .../webhook-triggers/<id>/attempts/... A server or proxy that normalizes paths answers that with the trigger itself, and the command then prints an emptyAttempt ID:/Status:instead of an error. Can we reject.and..too? Can we also move the check aboveloadTrigger, or intoArgs? 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 lineError: cannot create job: ...looks just like the CLI's ownError:prefix, even though the command succeeded. Maybe label itFailure:orError message:?
| // attempt stays queued. | ||
| if isNew { | ||
| attemptID := nextUUID() | ||
| s.GitWebhookAttempts[triggerID] = []gitwebhooks.AutoDeployAttempt{{ |
There was a problem hiding this comment.
[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') |
There was a problem hiding this comment.
[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'?
Regression test report ✅Commit: Selected 5 changed tests (limit=20, 0 not selected) 5 tests: regression=5 unreleased=0 coverage=0 failing=0
TestAccept/bundle/deployment/auto-deploy/attempts: branch ✅ | main (4c4f104) ❌ | latest (v1.28.0) ❌main (4c4f104): latest (v1.28.0): same output as main (4c4f104) 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/delete: 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) |
✅ Integration test reportCommit: 0a1d5c6
Top 3 slowest tests (at least 2 minutes):
|
denik
left a comment
There was a problem hiding this comment.
🤖 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 blankAttempt ID:/Status:with exit 0.
Other findings, ranked (not posted inline):
- 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.WithLimitis what the generated list commands use (e.g.jobs list). - Maintainability
libs/testserver/fake_workspace.go:334:GitWebhookAttemptskeeps 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 onfakeWebhookTriggerdrops the newFakeWorkspacefield, 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}}` |
There was a problem hiding this comment.
🤖 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.
`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>
5bfec4a to
0a1d5c6
Compare
67111f8 to
0333648
Compare
|
Thanks @denik. The other points:
The same changes are in #7943. |
This is #7943 under
bundle deployment.Changes
attemptslists the target's auto-deploy attempts, newest first, throughListAutoDeployAttempts. With an attempt ID, it shows that attempt throughGetAutoDeployAttempt. It rejects an ID that is empty or contains/, since the ID becomes a segment of the attempt's name.Why
Users need to see whether their pushes deployed, and why a deploy failed.
Tests
acceptance/bundle/deployment/auto-deploy/attemptscovers: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.