-
Notifications
You must be signed in to change notification settings - Fork 177
Expand file tree
/
Copy pathscript
More file actions
58 lines (45 loc) · 1.87 KB
/
script
File metadata and controls
58 lines (45 loc) · 1.87 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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
title "Bundle without workspace.host: default_profile is honored\n"
trace $CLI bundle validate -o json | jq '{host: .workspace.host, profile: .workspace.profile}'
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
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}')
# 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
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}')