mirror of https://github.com/databricks/cli.git
Compare commits
3 Commits
b7b49c75ea
...
3c53a6e7cc
Author | SHA1 | Date |
---|---|---|
Andrew Nester | 3c53a6e7cc | |
Andrew Nester | 1c571962d2 | |
Andrew Nester | 9cea93d159 |
|
@ -90,7 +90,7 @@ func TestGeneratePipelineCommand(t *testing.T) {
|
||||||
err := cmd.RunE(cmd, []string{})
|
err := cmd.RunE(cmd, []string{})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
data, err := os.ReadFile(filepath.Join(configDir, "test_pipeline.yml"))
|
data, err := os.ReadFile(filepath.Join(configDir, "test_pipeline.pipeline.yml"))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, fmt.Sprintf(`resources:
|
require.Equal(t, fmt.Sprintf(`resources:
|
||||||
pipelines:
|
pipelines:
|
||||||
|
@ -186,7 +186,7 @@ func TestGenerateJobCommand(t *testing.T) {
|
||||||
err := cmd.RunE(cmd, []string{})
|
err := cmd.RunE(cmd, []string{})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
data, err := os.ReadFile(filepath.Join(configDir, "test_job.yml"))
|
data, err := os.ReadFile(filepath.Join(configDir, "test_job.job.yml"))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
require.Equal(t, fmt.Sprintf(`resources:
|
require.Equal(t, fmt.Sprintf(`resources:
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package generate
|
package generate
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/fs"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
|
@ -83,7 +85,14 @@ func NewGenerateJobCommand() *cobra.Command {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
filename := filepath.Join(configDir, fmt.Sprintf("%s.yml", jobKey))
|
oldFilename := filepath.Join(configDir, fmt.Sprintf("%s.yml", jobKey))
|
||||||
|
filename := filepath.Join(configDir, fmt.Sprintf("%s.job.yml", jobKey))
|
||||||
|
|
||||||
|
err = os.Rename(oldFilename, filename)
|
||||||
|
if err != nil && !errors.Is(err, fs.ErrNotExist) {
|
||||||
|
return fmt.Errorf("failed to rename file %s. DABs uses resource type as sub extension for generated content, please rename to %s, err: %w", oldFilename, filename, err)
|
||||||
|
}
|
||||||
|
|
||||||
saver := yamlsaver.NewSaverWithStyle(map[string]yaml.Style{
|
saver := yamlsaver.NewSaverWithStyle(map[string]yaml.Style{
|
||||||
// Including all JobSettings and nested fields which are map[string]string type
|
// Including all JobSettings and nested fields which are map[string]string type
|
||||||
"spark_conf": yaml.DoubleQuotedStyle,
|
"spark_conf": yaml.DoubleQuotedStyle,
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package generate
|
package generate
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/fs"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
|
@ -83,7 +85,14 @@ func NewGeneratePipelineCommand() *cobra.Command {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
filename := filepath.Join(configDir, fmt.Sprintf("%s.yml", pipelineKey))
|
oldFilename := filepath.Join(configDir, fmt.Sprintf("%s.yml", pipelineKey))
|
||||||
|
filename := filepath.Join(configDir, fmt.Sprintf("%s.pipeline.yml", pipelineKey))
|
||||||
|
|
||||||
|
err = os.Rename(oldFilename, filename)
|
||||||
|
if err != nil && !errors.Is(err, fs.ErrNotExist) {
|
||||||
|
return fmt.Errorf("failed to rename file %s. DABs uses resource type as sub extension for generated content, please rename to %s, err: %w", oldFilename, filename, err)
|
||||||
|
}
|
||||||
|
|
||||||
saver := yamlsaver.NewSaverWithStyle(
|
saver := yamlsaver.NewSaverWithStyle(
|
||||||
// Including all PipelineSpec and nested fields which are map[string]string type
|
// Including all PipelineSpec and nested fields which are map[string]string type
|
||||||
map[string]yaml.Style{
|
map[string]yaml.Style{
|
||||||
|
|
Loading…
Reference in New Issue