Skip to content

Commit dce783d

Browse files
acc: keep heredoc created files checked in (#5938)
## Changes Move heredoc (`cat > file <<EOF` or similar) created files into source control. Either direct lifts [750d8b0](750d8b0) or simple `envsubst` replacements [79250aa](79250aa) ## Why Easier to review ## Tests Existing tests
1 parent d15ffbd commit dce783d

79 files changed

Lines changed: 314 additions & 406 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[default-target]
2+
host = $DATABRICKS_HOST
3+
token = $DATABRICKS_TOKEN
4+
5+
[other]
6+
host = https://other.test
7+
token = other-token
8+
9+
[__settings__]
10+
default_profile = default-target

acceptance/auth/bundle_default_profile/script

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,7 @@ sethome "./home"
33
# Save the test server host so we can pin a bundle-with-host variant below.
44
host_value="$DATABRICKS_HOST"
55

6-
cat > "./home/.databrickscfg" <<EOF
7-
[default-target]
8-
host = $DATABRICKS_HOST
9-
token = $DATABRICKS_TOKEN
10-
11-
[other]
12-
host = https://other.test
13-
token = other-token
14-
15-
[__settings__]
16-
default_profile = default-target
17-
EOF
6+
envsubst < "./home/.databrickscfg.tmpl" > "./home/.databrickscfg"
187

198
unset DATABRICKS_HOST
209
unset DATABRICKS_TOKEN
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[cached]
2+
host = ${DATABRICKS_HOST}
3+
token = test-token

acceptance/auth/host-metadata-cache/script

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ export DATABRICKS_CACHE_DIR="$TEST_TMP_DIR/cache"
44
# Point a profile at the mock server so auth profiles triggers a host metadata
55
# fetch. Validation must stay on: --skip-validate resolves offline and would
66
# never fetch or populate the cache.
7-
cat > "./home/.databrickscfg" <<EOF
8-
[cached]
9-
host = ${DATABRICKS_HOST}
10-
token = test-token
11-
EOF
7+
envsubst < "./home/.databrickscfg.tmpl" > "./home/.databrickscfg"
128

139
title "First invocation populates the cache\n"
1410
$CLI auth profiles --output json
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
bundle:
22
name: multi-profile-auto-select
3+
4+
workspace:
5+
host: $DATABRICKS_HOST

acceptance/bundle/multi_profile/auto_select/script

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
1-
# Set up .databrickscfg with two profiles for the same host:
2-
# one workspace profile and one account profile.
1+
# Substitute the actual host URL into the checked-in .databrickscfg (two profiles
2+
# for the same host: one workspace, one account) and databricks.yml.
33
envsubst < .databrickscfg > out && mv out .databrickscfg
4-
5-
# Write databricks.yml with the actual host URL.
6-
cat > databricks.yml << EOF
7-
bundle:
8-
name: multi-profile-auto-select
9-
10-
workspace:
11-
host: $DATABRICKS_HOST
12-
EOF
4+
envsubst < databricks.yml > out && mv out databricks.yml
135

146
export DATABRICKS_CONFIG_FILE=.databrickscfg
157
unset DATABRICKS_HOST
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
bundle:
22
name: multi-profile-env-skip
3+
4+
workspace:
5+
host: $DATABRICKS_HOST

acceptance/bundle/multi_profile/env_auth_skip/script

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
1-
# Set up .databrickscfg with two workspace profiles for the same host.
1+
# Substitute the actual host URL into the checked-in .databrickscfg (two
2+
# workspace profiles for the same host) and databricks.yml.
23
envsubst < .databrickscfg > out && mv out .databrickscfg
3-
4-
cat > databricks.yml << EOF
5-
bundle:
6-
name: multi-profile-env-skip
7-
8-
workspace:
9-
host: $DATABRICKS_HOST
10-
EOF
4+
envsubst < databricks.yml > out && mv out databricks.yml
115

126
export DATABRICKS_CONFIG_FILE=.databrickscfg
137
# Keep DATABRICKS_HOST and DATABRICKS_TOKEN set — env auth takes precedence
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
bundle:
22
name: multi-profile-no-ws
3+
4+
workspace:
5+
host: $DATABRICKS_HOST

acceptance/bundle/multi_profile/no_workspace_profiles/script

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
1-
# Set up .databrickscfg with two account-only profiles for the same host.
1+
# Substitute the actual host URL into the checked-in .databrickscfg (two
2+
# account-only profiles for the same host) and databricks.yml.
23
envsubst < .databrickscfg > out && mv out .databrickscfg
3-
4-
cat > databricks.yml << EOF
5-
bundle:
6-
name: multi-profile-no-ws
7-
8-
workspace:
9-
host: $DATABRICKS_HOST
10-
EOF
4+
envsubst < databricks.yml > out && mv out databricks.yml
115

126
export DATABRICKS_CONFIG_FILE=.databrickscfg
137
unset DATABRICKS_HOST

0 commit comments

Comments
 (0)