Generate warning during bundle generate in case of missing include#5868
Conversation
…generate-warn-missing-include # Conflicts: # NEXT_CHANGELOG.md # acceptance/bundle/generate/spark_python_task_job/output.txt
Move the changelog entry from NEXT_CHANGELOG.md into a .nextchanges/ fragment following the migration on main (#5534). Co-authored-by: Isaac
ProcessRootIncludes overwrites Config.Include with the expanded list of loaded files, so the bundle generate include check previously re-read and re-parsed databricks.yml to recover the raw patterns. Instead, ProcessRootIncludes now records the raw patterns on the bundle via SetIncludePatterns before overwriting them, and membership is exposed via Bundle.IsFileIncluded. warnIfNotIncluded no longer touches disk. Co-authored-by: Isaac
Integration test reportCommit: 34bf80e
8 interesting tests: 4 RECOVERED, 4 SKIP
Top 10 slowest tests (at least 2 minutes):
|
| @@ -0,0 +1 @@ | |||
| * `bundle generate` now warns when the generated configuration file is not matched by any pattern in the `include` section of `databricks.yml` ([#5868](https://github.com/databricks/cli/pull/5868)). | |||
There was a problem hiding this comment.
Do we still need the * prefix or the PR markdown link suffix?
There was a problem hiding this comment.
prefix is optional (gets added if missing) but we can be stricter (and if you want multiple lines you just add multiple files).
PR link suffix could be inferred by filename but not everyone will use the PR number as filename (especially if creating it before raising the PR)
There was a problem hiding this comment.
I thought there was some code to turn #1234 into a markdown link somewhere.
If not then disregard.
There was a problem hiding this comment.
there is task links, but it only runs local - if you don't commit it the checks task will fail. We don't rewrite commits in CI currently. See #5912
| @@ -0,0 +1 @@ | |||
| * `bundle generate` now warns when the generated configuration file is not matched by any pattern in the `include` section of `databricks.yml` ([#5868](https://github.com/databricks/cli/pull/5868)). | |||
There was a problem hiding this comment.
I thought there was some code to turn #1234 into a markdown link somewhere.
If not then disregard.
Integration test reportCommit: 56ec1f5
48 interesting tests: 22 FAIL, 20 flaky, 3 RECOVERED, 2 SKIP, 1 KNOWN
Top 50 slowest tests (at least 2 minutes):
|
## Release v1.8.0 ### Notable Changes * Auto-migrate a bundle from terraform to the direct engine when `bundle.engine` is `"direct"` (or `DATABRICKS_BUNDLE_ENGINE=direct`) and the post-deploy dry-run migration is clean; a warning is emitted if the dry-run surfaces errors or warnings so the automatic migration is skipped. ### CLI * experimental `ssh connect`: bare `python`/`pip` in an interactive session now resolve to the environment interpreter (`$DATABRICKS_VIRTUAL_ENV`) instead of the system or cluster-libraries interpreter, so packages installed in the environment are importable without extra setup. The interactive shell is now non-login (`bash -i`) and the server seeds a `~/.bashrc` snippet that re-prepends the environment's bin directory to `PATH` ([#5888](#5888)). * When Claude Code runs the CLI without the Databricks AI tooling installed, the CLI now prints a one-line recommendation on stderr to run `databricks aitools install`. The recommendation is shown at most once per hour per Claude session, and never for human callers or `aitools` commands. * Fixed `databricks auth describe` misattributing a profile selected via `DATABRICKS_CONFIG_PROFILE` as `(from bundle)` when run inside a bundle root ([#5904](#5904)). ### Bundles * `bundle generate` now warns when the generated configuration file is not matched by any pattern in the `include` section of `databricks.yml` ([#5868](#5868)). * direct: Match UC Auto Upgrade managed property defaults with a wildcard pattern instead of enumerating each key ([#5877](#5877)). * Recognize `ssh://` template URLs in `databricks bundle init` ([#5891](#5891)). * `databricks bundle init` now reports an actionable error when given a template URL with an unsupported protocol (`http://`, `git://`, `ftp://`, `ftps://`) instead of failing with a confusing "not a bundle template" message ([#5902](#5902)). * Added an `env:` section to `scripts.<name>` for declaring environment variables that may reference `${bundle.*}`, `${workspace.*}`, and `${var.*}` ([#4179](#4179), [#5299](#5299)).
Changes
bundle generatenow emits a warning when the generated config file lands in a directory that no pattern in the rootdatabricks.yml'sinclude:section matches. Such a file is written to disk but silently ignored on deploy, so generate is effectively a no-op without a matchinginclude:entry.Why
Prevent user error/unexpected behaviour.
Design decisions
includepatterns captured at load, not a re-read ofdatabricks.yml. During config load, the pre-existingProcessRootIncludesreplacesConfig.Includewith the expanded list of loaded files, discarding the original patterns. It now records them on the bundle via newly-addedSetIncludePatternsright before overwriting, and membership can be tested through the newBundle.IsFileIncluded— so the check touches no disk and can't drift from the loader.bundle, notconfig. Matching is filesystem resolution: it globs patterns againstBundleRootPath, which only exists at theBundlelayer.config.Rootis deliberately filesystem-agnostic (it just serializes to/from YAML). The patterns are config, but the operation is not.IsFileIncludedglobs against files currently on disk. The check runs after the file is written, so a freshly generated file is matched only if it now satisfies a pattern — exactly the question we're asking.includesection of the rootdatabricks.yml; anincludein any other file is ignored (with its own warning [ref]). So a file reachable only via a nested include genuinely won't deploy, and warning about it is correct.Tests
bundle.IsFileIncludedunit test (glob, exact match, non-recursive, absolute pattern ignored, empty include).acceptance/bundle/generate/include_warningcovering matched (no warning) and unmatched (warning) cases; existing generate acceptance outputs updated.This pull request and its description were written by Isaac, an AI coding agent.