Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Resources: 1 created, 0 changed, 0 deleted, 0 unchanged
{
"status": "skipped",
"error": "no deployed jobs resource with id no-such-id-999; deployed jobs ids in state: [TEST_JOB_ID]",
"errorCode": "NO_MATCHING_SELECTOR",
"files": null,
"changes": {}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
bundle:
name: config-remote-sync-no-matching-selector

resources:
jobs:
foo:
name: test job
tasks:
- task_key: main
notebook_task:
notebook_path: /Workspace/Users/tester@databricks.com/notebook
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Cloud = false
GOOS.windows = false
EnvMatrix.DMS = [""]
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

>>> [CLI] bundle deploy
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/config-remote-sync-no-matching-selector/default/files...
Created jobs.foo
Files: 1 uploaded, 0 deleted
Resources: 1 created, 0 changed, 0 deleted, 0 unchanged

>>> [CLI] bundle config-remote-sync --select-ids jobs:999999 -o json
{
"status": "skipped",
"error": "no deployed jobs resource with id 999999; deployed jobs ids in state: [FOO_ID]",
"errorCode": "NO_MATCHING_SELECTOR",
"files": null,
"changes": {}
}

>>> cat [OUTPUT_DIR]/out.requests.txt
{
"error_message": "no deployed jobs resource with id 999999; deployed jobs ids in state: [FOO_ID]",
"error_category": "NO_MATCHING_SELECTOR"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
trace $CLI bundle deploy
read_id.py foo > /dev/null

# No deployed job has this id, so the sync is skipped rather than failed.
trace $CLI bundle config-remote-sync --select-ids "jobs:999999" -o json

trace cat "$OUT_REQUESTS" | jq 'select(has("path") and .path == "/telemetry-ext") | .body.protoLogs[] | fromjson | .entry.databricks_cli_log.bundle_config_remote_sync_event | select(. != null) | {error_message, error_category}'

rm "$OUT_REQUESTS"
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# config-remote-sync is not supported on Windows.
GOOS.windows = false
4 changes: 4 additions & 0 deletions cmd/bundle/config_remote_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ Examples:
// changes are restricted to the selected resources.
selected, err := configsync.ResolveResourceSelectors(ctx, &deployBundle.StateDB, selectIDs)
if err != nil {
// Reported as skipped in JSON output, so it must not count as a load failure.
if errors.Is(err, configsync.ErrNoMatchingSelector) {
stats.ErrorCategory = protos.BundleConfigRemoteSyncErrorCategoryNoMatchingSelector
}
return err
}
// A selected resource planned as a delete was renamed or removed in the
Expand Down
5 changes: 4 additions & 1 deletion libs/telemetry/protos/bundle_config_remote_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const (
BundleConfigRemoteSyncErrorCategorySaveFailed BundleConfigRemoteSyncErrorCategory = "SAVE_FAILED"
BundleConfigRemoteSyncErrorCategoryOutputFailed BundleConfigRemoteSyncErrorCategory = "OUTPUT_FAILED"
BundleConfigRemoteSyncErrorCategoryResourceNotInConfig BundleConfigRemoteSyncErrorCategory = "RESOURCE_NOT_IN_CONFIG"
BundleConfigRemoteSyncErrorCategoryNoMatchingSelector BundleConfigRemoteSyncErrorCategory = "NO_MATCHING_SELECTOR"
)

// BundleConfigRemoteSyncEvent is emitted on every execution of the
Expand Down Expand Up @@ -121,7 +122,9 @@ type BundleConfigRemoteSyncEvent struct {
// stays in-region and is stripped from centralized logfood. Unset on success.
ErrorMessage string `json:"error_message,omitempty"`

// Category of the failure when the command exits with an error.
// Category of the failure when the command exits with an error, or
// NO_MATCHING_SELECTOR when no selector matched (reported as skipped in JSON
// output).
// Unset on success.
ErrorCategory BundleConfigRemoteSyncErrorCategory `json:"error_category,omitempty"`
}
Expand Down
Loading