Skip to content

Commit b33216b

Browse files
committed
Remove BundleConfig feature
1 parent 2a3cf48 commit b33216b

File tree

219 files changed

+515
-362
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

219 files changed

+515
-362
lines changed

acceptance/acceptance_test.go

Lines changed: 0 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"os"
1515
"os/exec"
1616
"path/filepath"
17-
"reflect"
1817
"regexp"
1918
"runtime"
2019
"slices"
@@ -26,7 +25,6 @@ import (
2625
"unicode/utf8"
2726

2827
"github.com/google/uuid"
29-
"gopkg.in/yaml.v3"
3028

3129
"github.com/databricks/cli/acceptance/internal"
3230
"github.com/databricks/cli/internal/testutil"
@@ -548,18 +546,6 @@ func runTest(t *testing.T,
548546
// Add materialized config to outputs for comparison
549547
outputs[internal.MaterializedConfigFile] = true
550548

551-
bundleConfigTarget := "databricks.yml"
552-
if config.BundleConfigTarget != nil {
553-
bundleConfigTarget = *config.BundleConfigTarget
554-
}
555-
556-
if bundleConfigTarget != "" {
557-
configCreated := applyBundleConfig(t, tmpDir, config.BundleConfig, bundleConfigTarget)
558-
if configCreated {
559-
inputs[bundleConfigTarget] = true
560-
}
561-
}
562-
563549
timeout := config.Timeout
564550

565551
if runtime.GOOS == "windows" {
@@ -1378,77 +1364,6 @@ func prepareWheelBuildDirectory(t *testing.T, dir string) string {
13781364
return latestWheel
13791365
}
13801366

1381-
// Applies BundleConfig setting to file named bundleConfigTarget and updates it in place if there were any changes.
1382-
// Returns true if new file was created.
1383-
func applyBundleConfig(t *testing.T, tmpDir string, bundleConfig map[string]any, bundleConfigTarget string) bool {
1384-
validConfig := make(map[string]map[string]any, len(bundleConfig))
1385-
1386-
for _, configName := range utils.SortedKeys(bundleConfig) {
1387-
configValue := bundleConfig[configName]
1388-
// Setting BundleConfig.<name> to empty string disables it.
1389-
// This is useful when parent directory defines some config that child test wants to cancel.
1390-
if configValue == "" {
1391-
continue
1392-
}
1393-
cfg, ok := configValue.(map[string]any)
1394-
if !ok {
1395-
t.Fatalf("Unexpected type for BundleConfig.%s: %#v", configName, configValue)
1396-
}
1397-
validConfig[configName] = cfg
1398-
}
1399-
1400-
if len(validConfig) == 0 {
1401-
return false
1402-
}
1403-
1404-
configPath := filepath.Join(tmpDir, bundleConfigTarget)
1405-
configData, configExists := tryReading(t, configPath)
1406-
1407-
newConfigData := configData
1408-
var applied []string
1409-
1410-
for _, configName := range utils.SortedKeys(validConfig) {
1411-
configValue := validConfig[configName]
1412-
updated, err := internal.MergeBundleConfig(newConfigData, configValue)
1413-
if err != nil {
1414-
t.Fatalf("Failed to merge BundleConfig.%s: %s\nvvalue: %#v\ntext:\n%s", configName, err, configValue, newConfigData)
1415-
}
1416-
if isSameYAMLContent(newConfigData, updated) {
1417-
t.Logf("No effective updates from BundleConfig.%s", configName)
1418-
} else {
1419-
newConfigData = updated
1420-
applied = append(applied, configName)
1421-
}
1422-
}
1423-
1424-
if newConfigData != configData {
1425-
t.Logf("Writing updated bundle config to %s. BundleConfig sections: %s", bundleConfigTarget, strings.Join(applied, ", "))
1426-
testutil.WriteFile(t, configPath, newConfigData)
1427-
return !configExists
1428-
}
1429-
1430-
return false
1431-
}
1432-
1433-
// Returns true if both strings are deep-equal after unmarshalling
1434-
func isSameYAMLContent(str1, str2 string) bool {
1435-
var obj1, obj2 any
1436-
1437-
if str1 == str2 {
1438-
return true
1439-
}
1440-
1441-
if err := yaml.Unmarshal([]byte(str1), &obj1); err != nil {
1442-
return false
1443-
}
1444-
1445-
if err := yaml.Unmarshal([]byte(str2), &obj2); err != nil {
1446-
return false
1447-
}
1448-
1449-
return reflect.DeepEqual(obj1, obj2)
1450-
}
1451-
14521367
func BuildYamlfmt(t *testing.T) {
14531368
// Using make here instead of "go build" directly cause it's faster when it's already built
14541369
args := []string{

acceptance/bundle/apps/app_yaml/databricks.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
bundle:
2+
name: test-bundle
3+
14
resources:
25
apps:
36
myapp:

acceptance/bundle/artifacts/artifact_upload_for_volumes/databricks.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
bundle:
2+
name: test-bundle
3+
14
workspace:
25
artifact_path: /Volumes/foo/bar/artifacts
36

acceptance/bundle/artifacts/artifact_upload_for_workspace/databricks.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
bundle:
2+
name: test-bundle
3+
14
workspace:
25
artifact_path: /foo/bar/artifacts
36

acceptance/bundle/artifacts/artifact_upload_with_no_library_reference/databricks.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
bundle:
2+
name: test-bundle
3+
14
workspace:
25
artifact_path: /Workspace/foo/bar/artifacts
36

acceptance/bundle/artifacts/artifacts_dynamic_version/databricks.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
bundle:
2+
name: test-bundle
3+
14
presets:
25
artifacts_dynamic_version: true
36

acceptance/bundle/artifacts/build_and_files/databricks.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
bundle:
2+
name: test-bundle
3+
14
artifacts:
25
custom:
36
build: touch built.txt

acceptance/bundle/artifacts/build_and_files_whl/databricks.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
bundle:
2+
name: test-bundle
3+
14
artifacts:
25
artifact_with_custom_dist:
36
type: whl

acceptance/bundle/artifacts/glob_exact_whl/databricks.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
bundle:
2+
name: test-bundle
3+
14
artifacts:
25
my_prebuilt_whl:
36
type: whl
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1+
bundle:
2+
name: test-bundle
3+
14
include:
25
- resources/artifacts.yml

0 commit comments

Comments
 (0)