Skip to content
Merged
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
@@ -0,0 +1,5 @@
bundle:
name: bundle-with-host

workspace:
host: $DATABRICKS_HOST
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
bundle:
name: bundle-with-profile

workspace:
profile: other
26 changes: 6 additions & 20 deletions acceptance/auth/bundle_default_profile/script
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,25 @@ unset DATABRICKS_HOST
unset DATABRICKS_TOKEN
unset DATABRICKS_CONFIG_PROFILE

cp databricks.yml.no-host.tmpl databricks.yml
title "Bundle without workspace.host: default_profile is honored\n"
trace $CLI bundle validate -o json | jq '{host: .workspace.host, profile: .workspace.profile}'

cp databricks.yml.no-host.tmpl databricks.yml
title "--profile overrides default_profile (negative case)\n"
trace errcode $CLI bundle validate -p other -o json | jq '{host: .workspace.host, profile: .workspace.profile}'

# Switch to a bundle that pins workspace.host. The default_profile guard in
# configureProfile must NOT apply default_profile here, because that would
# silently route the user to a profile pointing at a different host than the
# bundle declares.
mkdir -p ./bundle-with-host
cat > ./bundle-with-host/databricks.yml <<EOF
bundle:
name: bundle-with-host

workspace:
host: $host_value
EOF

DATABRICKS_HOST="$host_value" envsubst < databricks.yml.with-host.tmpl > databricks.yml
title "Bundle with workspace.host: default_profile is NOT applied\n"
(cd ./bundle-with-host && trace errcode $CLI bundle validate -o json | jq '{host: .workspace.host, profile: .workspace.profile}')
trace errcode $CLI bundle validate -o json | jq '{host: .workspace.host, profile: .workspace.profile}'

# Switch to a bundle that pins workspace.profile but no host. The pinned
# profile must win over default_profile — configureProfile's guard skips
# default_profile when workspace.profile is already set.
mkdir -p ./bundle-with-profile
cat > ./bundle-with-profile/databricks.yml <<EOF
bundle:
name: bundle-with-profile

workspace:
profile: other
EOF

cp databricks.yml.with-profile.tmpl databricks.yml
title "Bundle with workspace.profile: pinned profile wins over default_profile\n"
(cd ./bundle-with-profile && trace errcode $CLI bundle validate -o json | jq '{host: .workspace.host, profile: .workspace.profile}')
trace errcode $CLI bundle validate -o json | jq '{host: .workspace.host, profile: .workspace.profile}'
3 changes: 1 addition & 2 deletions acceptance/auth/bundle_default_profile/test.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
Ignore = [
"home",
".databricks",
"bundle-with-host",
"bundle-with-profile",
"databricks.yml",
]

# Negative case: -p other tries to reach a non-existing host. Redact the
Expand Down
Loading