You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Log diagnostics immediately after mutator ends (#3175)
## Changes
- New package: logdiag with
- logdiag.LogDiag(ctx, d): render and logs Diagnostic object on stderr
right away. Counts diagnostic type (error, warning, recommendation) on
the context variable.
- logdiag.HasError(ctx) — return true if there were any errors seen so
far.
- New functions bundle.ApplyContext/ApplySeqContext (to replace
bundle.Apply/ApplySeq). These functions do not return diagnostics, but
calls LogDiag on every diagnostic returned by the mutator.
bundle.Apply and bundle.ApplySeq are still available as wrappers around
Context counterparts. The main use case for these is unit tests.
Note, with this PR mutators may choose whether to use LogDiag to log
diagnostics right away or to return it as usual. This has exactly the
same effect (except if you return it it is delayed a bit). For new code,
LogDiag should be preferred, eventually mutator interface will be
modified not to return diagnostics. Note, even if you use LogDiag,
bundle.Apply will still return the diagnostics logged.
Other behavior changes:
- diagnostics are now always logged to stderr; previously "bundle
summary" non-json would print them to stdout.
- slashes in the filenames in diagnostics are normalized to have forward
slashes, to help with acceptance tests.
- summary command won't print recommendations (but it'll keep on
printing warnings)
## Why
Collection of diagnostics and printing them at the very end is poor user
and developer experience.
User experience:
- Users will miss diagnostics if process crashes/panics;
- For long running deployments, useful information is not printed right
away;
- For deploys with interactive approval, diagnostics may show issues
that should be fixed before the deployment. Since they not shown, users
cannot make informed choice.
Developer experience:
- High accidental complexity to propagate the diagnostics properly.
- Various bugs over time where diagnostics were lost due to logic or
threading bugs (#2057, #2927,
#3123)
## Tests
Existing tests.
Note, we have no coverage for shell completion in bundle.
---------
Co-authored-by: Pieter Noordhuis <pieter.noordhuis@databricks.com>
Copy file name to clipboardExpand all lines: NEXT_CHANGELOG.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,10 @@
3
3
## Release v0.259.0
4
4
5
5
### Notable Changes
6
+
* Diagnostics messages are no longer buffered to be printed at the end of command, flushed after every mutator ([#3175](https://github.com/databricks/cli/pull/3175))
7
+
* Diagnostics are now always rendered with forward slashes in file paths, even on Windows ([#3175](https://github.com/databricks/cli/pull/3175))
8
+
* "bundle summary" now prints diagnostics to stderr instead of stdout in text output mode ([#3175](https://github.com/databricks/cli/pull/3175))
9
+
* "bundle summary" no longer prints recommendations, it will only prints warnings and errors ([#3175](https://github.com/databricks/cli/pull/3175))
Copy file name to clipboardExpand all lines: acceptance/auth/bundle_and_profile/output.txt
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,7 @@ Exit code: 1
21
21
>>> errcode [CLI] current-user me -t dev -p profile_name
22
22
Error: cannot resolve bundle auth configuration: the host in the profile (https://non-existing-subdomain.databricks.com) doesn’t match the host configured in the bundle ([DATABRICKS_TARGET]). The profile "DEFAULT" has host="[DATABRICKS_TARGET]" that matches host in the bundle. To select it, pass "-p DEFAULT"
23
23
24
+
24
25
Exit code: 1
25
26
26
27
=== Bundle commands load bundle configuration when no flags, validation OK
Copy file name to clipboardExpand all lines: acceptance/bundle/deploy/jobs/shared-root-path/output.txt
+6-2Lines changed: 6 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,19 @@
1
1
2
2
>>> [CLI] bundle deploy
3
+
Warning: the bundle root path /Workspace/Shared/[USERNAME]/.bundle/[UNIQUE_NAME] is writable by all workspace users
4
+
5
+
The bundle is configured to use /Workspace/Shared, which will give read/write access to all users. If this is intentional, add CAN_MANAGE for 'group_name: users' permission to your bundle configuration. If the deployment should be restricted, move it to a restricted folder such as /Workspace/Users/<username or principal name>.
6
+
3
7
Uploading bundle files to /Workspace/Shared/[USERNAME]/.bundle/[UNIQUE_NAME]/files...
4
8
Deploying resources...
5
9
Updating deployment state...
6
10
Deployment complete!
11
+
12
+
>>> [CLI] bundle destroy --auto-approve
7
13
Warning: the bundle root path /Workspace/Shared/[USERNAME]/.bundle/[UNIQUE_NAME] is writable by all workspace users
8
14
9
15
The bundle is configured to use /Workspace/Shared, which will give read/write access to all users. If this is intentional, add CAN_MANAGE for 'group_name: users' permission to your bundle configuration. If the deployment should be restricted, move it to a restricted folder such as /Workspace/Users/<username or principal name>.
Copy file name to clipboardExpand all lines: acceptance/bundle/deployment/bind/job/job-abort-bind/output.txt
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
Created job with ID: [NUMID]
4
4
5
5
=== Expect binding to fail without an auto-approve flag:
6
-
Error: failed to bind the resource, err: This bind operation requires user confirmation, but the current console does not support prompting. Please specify --auto-approve if you would like to skip prompts and proceed.
6
+
Error: This bind operation requires user confirmation, but the current console does not support prompting. Please specify --auto-approve if you would like to skip prompts and proceed.
0 commit comments