Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 214
First look for databricks.yml before falling back to bundle.yml#580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ed038ea
first look for databricks.yaml before falling back to bundle.yml
fjakobs 2d0ead8
Update bundle/config/root.go
fjakobs dcb4e66
Update bundle/config/root.go
fjakobs 2d87c78
Address PR feedback
fjakobs 3d3c2c9
use databricks.yml by default
fjakobs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -2,7 +2,11 @@ package config | ||
| import ( | ||
| "encoding/json" | ||
| "os" | ||
| "path/filepath" | ||
| "reflect" | ||
| "runtime" | ||
| "strings" | ||
| "testing" | ||
| "github.com/databricks/cli/bundle/config/variable" | ||
| @@ -26,7 +30,7 @@ func TestRootMarshalUnmarshal(t *testing.T) { | ||
| func TestRootLoad(t *testing.T) { | ||
| root := &Root{} | ||
| err := root.Load("../tests/basic/bundle.yml") | ||
| err := root.Load("../tests/basic/databricks.yml") | ||
| require.NoError(t, err) | ||
| assert.Equal(t, "basic", root.Bundle.Name) | ||
| } | ||
| @@ -78,21 +82,21 @@ func TestRootMergeMap(t *testing.T) { | ||
| func TestDuplicateIdOnLoadReturnsError(t *testing.T) { | ||
| root := &Root{} | ||
| err := root.Load("./testdata/duplicate_resource_names_in_root/bundle.yml") | ||
| assert.ErrorContains(t, err, "multiple resources named foo (job at ./testdata/duplicate_resource_names_in_root/bundle.yml, pipeline at ./testdata/duplicate_resource_names_in_root/bundle.yml)") | ||
| err := root.Load("./testdata/duplicate_resource_names_in_root/databricks.yml") | ||
| assert.ErrorContains(t, err, "multiple resources named foo (job at ./testdata/duplicate_resource_names_in_root/databricks.yml, pipeline at ./testdata/duplicate_resource_names_in_root/databricks.yml)") | ||
| } | ||
| func TestDuplicateIdOnMergeReturnsError(t *testing.T) { | ||
| root := &Root{} | ||
| err := root.Load("./testdata/duplicate_resource_name_in_subconfiguration/bundle.yml") | ||
| err := root.Load("./testdata/duplicate_resource_name_in_subconfiguration/databricks.yml") | ||
| require.NoError(t, err) | ||
| other := &Root{} | ||
| err = other.Load("./testdata/duplicate_resource_name_in_subconfiguration/resources.yml") | ||
| require.NoError(t, err) | ||
| err = root.Merge(other) | ||
| assert.ErrorContains(t, err, "multiple resources named foo (job at ./testdata/duplicate_resource_name_in_subconfiguration/bundle.yml, pipeline at ./testdata/duplicate_resource_name_in_subconfiguration/resources.yml)") | ||
| assert.ErrorContains(t, err, "multiple resources named foo (job at ./testdata/duplicate_resource_name_in_subconfiguration/databricks.yml, pipeline at ./testdata/duplicate_resource_name_in_subconfiguration/resources.yml)") | ||
| } | ||
| func TestInitializeVariables(t *testing.T) { | ||
| @@ -163,3 +167,62 @@ func TestRootMergeEnvironmentWithMode(t *testing.T) { | ||
| require.NoError(t, root.MergeEnvironment(env)) | ||
| assert.Equal(t, Development, root.Bundle.Mode) | ||
| } | ||
| func TestConfigFileNames_FindInPath(t *testing.T) { | ||
| testCases := []struct { | ||
| name string | ||
| files []string | ||
| expected string | ||
| err string | ||
| }{ | ||
| { | ||
| name: "file found", | ||
| files: []string{"databricks.yml"}, | ||
| expected: "BASE/databricks.yml", | ||
| err: "", | ||
| }, | ||
fjakobs marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| { | ||
| name: "file found", | ||
| files: []string{"bundle.yml"}, | ||
| expected: "BASE/bundle.yml", | ||
| err: "", | ||
| }, | ||
| { | ||
| name: "multiple files found", | ||
| files: []string{"databricks.yaml", "bundle.yml"}, | ||
| expected: "", | ||
| err: "multiple bundle root configuration files found", | ||
| }, | ||
| { | ||
| name: "file not found", | ||
| files: []string{}, | ||
| expected: "", | ||
| err: "no such file or directory", | ||
| }, | ||
| } | ||
| if runtime.GOOS == "windows" { | ||
| testCases[3].err = "The system cannot find the file specified." | ||
| } | ||
| for _, tc := range testCases { | ||
| t.Run(tc.name, func(t *testing.T) { | ||
| projectDir := t.TempDir() | ||
| for _, file := range tc.files { | ||
| f1, _ := os.Create(filepath.Join(projectDir, file)) | ||
| f1.Close() | ||
| } | ||
| result, err := FileNames.FindInPath(projectDir) | ||
| expected := strings.Replace(tc.expected, "BASE/", projectDir+string(os.PathSeparator), 1) | ||
| assert.Equal(t, expected, result) | ||
| if tc.err != "" { | ||
| assert.ErrorContains(t, err, tc.err) | ||
| } else { | ||
| assert.NoError(t, err) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -76,8 +76,8 @@ func TestRootLookup(t *testing.T) { | ||
| chdir(t, t.TempDir()) | ||
| // Create bundle.yml file. | ||
| f, err := os.Create(config.FileName) | ||
| // Create databricks.yml file. | ||
| f, err := os.Create(config.FileNames[0]) | ||
pietern marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| require.NoError(t, err) | ||
| defer f.Close() | ||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.