Repository navigation
Expose the workspace context to bundle templates as .workspace - #7349
Merged
Merged
Conversation
Contributor
|
Commit: Regression test reportSelected 2 changed tests (limit=20, 0 not selected) 4 tests: regression=4 unreleased=0 coverage=0 failing=0
TestAccept/bundle/templates-machinery/workspace_variable/input/DMS=: branch ✅ | main (eb1328d) ❌ | latest (v1.24.0) ❌main (eb1328d): latest (v1.24.0): TestAccept/bundle/templates-machinery/workspace_variable/input/DMS=true: branch ✅ | main (eb1328d) ❌ | latest (v1.24.0) ❌main (eb1328d): latest (v1.24.0): same output as main (eb1328d) TestAccept/bundle/templates-machinery/workspace_variable/runtime/DMS=: branch ✅ | main (eb1328d) ❌ | latest (v1.24.0) ❌main (eb1328d): latest (v1.24.0): same output as main (eb1328d) TestAccept/bundle/templates-machinery/workspace_variable/runtime/DMS=true: branch ✅ | main (eb1328d) ❌ | latest (v1.24.0) ❌main (eb1328d): latest (v1.24.0): |
Templates get the workspace of the selected profile as .workspace, in template files and in schema rendering. It has Hostname, ID and URL. URL adds ?w=<id> when a profile, an environment variable, or the bundle in the working directory sets the workspace ID, so that a host shared by several workspaces selects the right one. An ID that the SDK resolved from host metadata is not added, so the host still matches a profile without workspace_id under strict profile matching. ID fails when the ID is unknown, and doesn't make a request to find it. A workspace input declared in the schema takes precedence. Co-authored-by: Isaac <no-reply@databricks.com>
pavloKozlov
force-pushed
the
workspace-context-template-data
branch
from
November 4, 2026 15:41
b931f85 to
5f2f6db
Compare
Collaborator
✅ Integration test reportCommit: ea56a04
Top 3 slowest tests (at least 2 minutes):
|
Strict profile matching compares the workspace ID in the bundle host with the profile's workspace_id and doesn't read it from an adb-<id> hostname. Without ?w=, a profile with workspace_id on such a host didn't match the generated host. URL no longer uses workspaceurls.WorkspaceBaseURL, which skips ?w= there, so that package is unchanged. Co-authored-by: Isaac <no-reply@databricks.com>
RenderSchema skipped a property when the input file had a value for it, so its default came back as template text. A caller that renders the schema again with the current inputs got, for example, the raw .workspace.URL expression. The default is now rendered, and the input value is still the one used for the following properties. Co-authored-by: Isaac <no-reply@databricks.com>
Hostname is now the host name only, without the port, like url.URL.Hostname. Databricks hosts don't have an explicit port, so this changes nothing for them. Co-authored-by: Isaac <no-reply@databricks.com>
This reverts 51344db. Templates that strip the scheme from workspace_host get host:port, so keeping the port gives them the same value with .workspace.Hostname. Databricks hosts don't have an explicit port, so for them both are the same. Co-authored-by: Isaac <no-reply@databricks.com>
denik
approved these changes
Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Bundle templates can read the workspace of the selected profile as
.workspace, in template files and in the schema (defaults, descriptions, messages). It hasHostname,IDandURL.URL "/jobs"returns a workspace URL and adds?w=<id>when the profile, an environment variable, or a bundle in the working directory sets the workspace ID.IDfails when the ID is unknown and doesn't make a request to find it. A schema input namedworkspacetakes precedence.Schema rendering now renders the default of a property that already has an input value, instead of returning template text. The input value is kept.
Why
When several workspaces share one host,
workspace_hostcan't select the workspace. An ID that the SDK resolved from host metadata is not added to URLs, because a profile withoutworkspace_idwould then not match the host under strict profile matching.Tests
Acceptance tests cover URLs and IDs for each kind of profile, env vars, a bundle in the working directory, invalid paths, the
workspaceinput rules, and a schema rerender with edited inputs. Unit tests cover prompts andadb-<id>hosts.This pull request and its description were written by Isaac.