Skip to content

Commit 5b39bf3

Browse files
Fix CI failures in deploy telemetry
Two fixes: 1. Remove redundant empty BundleDeployEvent logging in root.go Execute. The defer in process.go already logs detailed deploy telemetry via LogDeployTelemetry on all exit paths. The root.go code caused duplicate events and Upload retries (mock returns numProtoSuccess=1). 2. Add HasConfigUsed guard in telemetry.Upload before calling ConfigUsed. When bundle config fails early (e.g., restricted script execution blocking preinit), ConfigUsed is never set on the context. The LogDeployTelemetry defer still logs an event, so Upload would panic trying to create an API client without auth config. Co-authored-by: Isaac
1 parent 3bc2436 commit 5b39bf3

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

cmd/root/root.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -179,15 +179,6 @@ Stack Trace:
179179
commandStr := commandString(cmd)
180180
ctx = cmd.Context()
181181

182-
// Log bundle deploy failures. Only log if we have successfully configured
183-
// an authenticated Databricks client. We cannot log unauthenticated telemetry
184-
// from the CLI yet.
185-
if cmdctx.HasConfigUsed(ctx) && commandStr == "bundle_deploy" && exitCode != 0 {
186-
telemetry.Log(ctx, protos.DatabricksCliLog{
187-
BundleDeployEvent: &protos.BundleDeployEvent{},
188-
})
189-
}
190-
191182
telemetryErr := telemetry.Upload(cmd.Context(), protos.ExecutionContext{
192183
CmdExecID: cmdctx.ExecId(ctx),
193184
Version: build.GetInfo().Version,

libs/telemetry/logger.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ func Upload(ctx context.Context, ec protos.ExecutionContext) error {
7676
protoLogs[i] = string(b)
7777
}
7878

79+
if !cmdctx.HasConfigUsed(ctx) {
80+
log.Debugf(ctx, "no auth config available; skipping telemetry upload")
81+
return nil
82+
}
83+
7984
apiClient, err := client.New(cmdctx.ConfigUsed(ctx))
8085
if err != nil {
8186
return fmt.Errorf("failed to create API client: %w", err)

0 commit comments

Comments
 (0)