Repository navigation
Record the auto-deploy attempt on the deployment version - #7935
atreyadbrx wants to merge 2 commits into
Conversation
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>
✅ Integration test reportCommit: 3e4f7f0
|
There was a problem hiding this comment.
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.
| } | ||
| // 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) |
There was a problem hiding this comment.
[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?
There was a problem hiding this comment.
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 | |||
There was a problem hiding this comment.
[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?
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
[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?
There was a problem hiding this comment.
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 |
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 deployment ID that way?
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
[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?
There was a problem hiding this comment.
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>
Changes
When
DATABRICKS_AUTO_DEPLOY_ATTEMPTis set,bundle deploysends it asauto_deploy_attempton theCreateVersionrequest instartVersion, 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: theCreateVersionrequest 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 otherbundle/dmsorbundle/deployoutput changes.This pull request and its description were written by Isaac.