Skip to content

Record the auto-deploy attempt on the deployment version - #7935

Open
atreyadbrx wants to merge 2 commits into
mainfrom
dabs-ad-d3-attempt-name
Open

atreyadbrx wants to merge 2 commits into
mainfrom
dabs-ad-d3-attempt-name

Conversation

@atreyadbrx

@atreyadbrx atreyadbrx commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Changes

When DATABRICKS_AUTO_DEPLOY_ATTEMPT is set, bundle deploy sends it as auto_deploy_attempt on the CreateVersion request in startVersion, so the deployment metadata service links the version to the auto-deploy attempt that ran it. The value is passed through as is; the service validates it. Without the variable the request doesn't change.

Doesn't build yet: this needs a Go SDK release with Version.AutoDeployAttempt, which isn't in the public API spec yet. I'll rebase it once the SDK bump picks the field up. Don't merge until the service accepts the field in every region.

Why

The DABs auto-deploy runner sets this variable to the attempt name (webhook-triggers/{trigger_id}/attempts/{attempt_id}), so a deployment's history shows which versions an auto-deploy created, and from which attempt.

Tests

New acceptance test bundle/dms/attempt-name: the CreateVersion request carries the attempt when the variable is set, and has none without it or on a destroy. I ran it against a local SDK copy with the field added; the output gets regenerated after the SDK bump. No other bundle/dms or bundle/deploy output changes.

This pull request and its description were written by Isaac.

When DATABRICKS_AUTO_DEPLOY_ATTEMPT is set, bundle deploy sends it as
auto_deploy_attempt on the CreateVersion request, so the deployment
metadata service links the version to the auto-deploy attempt that ran
it. The value is passed through as is; the service validates it. Without
the variable the request doesn't change.

This needs a Go SDK release with Version.AutoDeployAttempt and doesn't
build until then.

Signed-off-by: atreyadbrx <atreya.misra@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
@atreyadbrx
atreyadbrx requested a review from pietern November 24, 2026 16:42
@github-actions github-actions Bot added the DABs DABs related issues label Nov 24, 2026
@eng-dev-ecosystem-bot

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

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: 3e4f7f0

Run: 45491002322

Env ✅​pass 🙈​skip Time
✅​ aws linux-2core-8gb 69 15 0:40
✅​ aws-windows-latest-4core-16gb 69 15 0:50
✅​ azure linux-2core-8gb 68 15 0:36
✅​ azure-windows-latest-4core-16gb 68 15 0:51
✅​ gcp linux-2core-8gb 69 15 0:40
✅​ gcp-windows-latest-4core-16gb 69 15 0:48

@atreyadbrx
atreyadbrx marked this pull request as ready for review November 24, 2026 19:08
@atreyadbrx
atreyadbrx requested review from a team as code owners November 24, 2026 19:08

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

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

This PR passes DATABRICKS_AUTO_DEPLOY_ATTEMPT through as auto_deploy_attempt on the CreateVersion request, so a deployment version is linked to the auto-deploy attempt that ran it. The Go change is small, and when the variable is unset the request is the same as before. One open question is whether destroys should carry the attempt too, since startVersion serves both deploys and destroys. The new acceptance test also runs in the cloud with a made-up attempt name and never cleans up after itself, and it has a few small convention issues. As the description says, this can't merge until the SDK bump adds Version.AutoDeployAttempt.

Comment thread bundle/phases/dms.go Outdated
}
// Links the version to the auto-deploy attempt that ran it, passed through as is for the service
// to validate. Other deploys leave it unset, so their request doesn't change.
attempt, _ := env.AutoDeployAttempt(ctx)

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] startVersion is also called from prepareDestroyHistory with dms.VersionTypeDestroy, so with DATABRICKS_AUTO_DEPLOY_ATTEMPT set, bundle destroy also sends auto_deploy_attempt on its destroy version. The description and the doc on AutoDeployAttemptVariable only mention deploys. Should this be limited to versionType == dms.VersionTypeDeploy? If destroys are meant to carry it, can the doc say so and the test cover a destroy?

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.

Limited to deploys in 3e4f7f0. Auto-deploy never runs bundle destroy, so only a deploy's version carries the attempt. The acceptance test now runs a destroy with the variable set and shows its version has no auto_deploy_attempt.

@@ -0,0 +1,15 @@
envsubst < databricks.yml.tmpl > databricks.yml
attempt=webhook-triggers/11111111-1111-1111-1111-111111111111/attempts/22222222-2222-2222-2222-222222222222

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] This test inherits Cloud = true from acceptance/bundle/dms/test.toml (see out.test.toml), so it also runs against a real workspace with a made-up webhook-triggers/1111…/attempts/2222… name. The description says the service validates the value. If it checks that the attempt exists, the first deploy fails with "failed to create deployment version" in the cloud run. Should this directory set Cloud = false until there's a real attempt to point at, or was it checked against a workspace?

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.

The service checks only the attempt name's format, not that the attempt exists, and this name is well formed (lowercase canonical UUIDs). It hasn't run against a workspace yet, because no workspace accepts the field until it ships. That's also when this PR can merge, so I'm keeping the cloud run: it confirms the field is live.

envsubst < databricks.yml.tmpl > databricks.yml
attempt=webhook-triggers/11111111-1111-1111-1111-111111111111/attempts/22222222-2222-2222-2222-222222222222

title "With DATABRICKS_AUTO_DEPLOY_ATTEMPT set, the version the deploy creates records the attempt"

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] Nothing destroys the bundle at the end, so on the inherited cloud run the job (foo/renamed), the bundle files and the DMS deployment are left in the workspace after every run. Can you add trap "errcode trace '$CLI' bundle destroy --auto-approve" EXIT before the first deploy?

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.

Added in 3e4f7f0. The last step destroys the bundle itself, to check that a destroy carries no attempt, so the script clears the trap after it.


title "With DATABRICKS_AUTO_DEPLOY_ATTEMPT set, the version the deploy creates records the attempt"
trace DATABRICKS_AUTO_DEPLOY_ATTEMPT=$attempt $CLI bundle deploy
add_repl "$($CLI bundle summary -o json | jq -r .bundle.deployment.deployment_id)" DEPLOYMENT_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 deployment ID that way?

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.

There's no helper for the deployment ID, and gron.py prints path = value; lines, so capturing a bare value with it takes more parsing than jq -r. bundle summary returns the ID as a string, so jq can't round it. I've kept it as is.

trace print_requests.py --dms //versions ^//operations ^//complete

# The deploys upload files in a nondeterministic order; only the requests above are asserted.
rm -f "$OUT_REQUESTS"

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] print_requests.py already unlinks $OUT_REQUESTS unless you pass --keep, and no requests are made after the last call. So this rm -f does nothing, and the comment about upload order is misleading. Can both be dropped?

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.

Dropped in 3e4f7f0, along with the comment.

startVersion also creates destroy versions, and auto-deploy never runs
bundle destroy, so only a deploy's version carries the attempt. The
acceptance test covers a destroy with the variable set, destroys the
bundle on exit for the cloud run, and drops a no-op rm.

Signed-off-by: atreyadbrx <atreya.misra@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>

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

DABs DABs related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants