-
Notifications
You must be signed in to change notification settings - Fork 187
Expand file tree
/
Copy pathscript
More file actions
44 lines (35 loc) · 1.75 KB
/
Copy pathscript
File metadata and controls
44 lines (35 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
sethome "./home"
# Save the test server host so we can pin a bundle-with-host variant below.
host_value="$DATABRICKS_HOST"
cat > "./home/.databrickscfg" <<EOF
[default-target]
host = $DATABRICKS_HOST
token = $DATABRICKS_TOKEN
[other]
host = https://other.test
token = other-token
[__settings__]
default_profile = default-target
EOF
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.
DATABRICKS_HOST="$host_value" envsubst < databricks.yml.with-host.tmpl > databricks.yml
title "Bundle with workspace.host: default_profile is NOT applied\n"
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.
cp databricks.yml.with-profile.tmpl databricks.yml
title "Bundle with workspace.profile: pinned profile wins over default_profile\n"
trace errcode $CLI bundle validate -o json | jq '{host: .workspace.host, profile: .workspace.profile}'