From 9cea93d1598462e8687860825a5102b93b1bf9fe Mon Sep 17 00:00:00 2001 From: Andrew Nester Date: Thu, 14 Nov 2024 13:42:50 +0100 Subject: [PATCH] Update filenames used by bundle generate to use '..yml' --- cmd/bundle/generate/job.go | 10 +++++++++- cmd/bundle/generate/pipeline.go | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/cmd/bundle/generate/job.go b/cmd/bundle/generate/job.go index 99bc6166..15102ac4 100644 --- a/cmd/bundle/generate/job.go +++ b/cmd/bundle/generate/job.go @@ -83,7 +83,15 @@ func NewGenerateJobCommand() *cobra.Command { 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 { + return fmt.Errorf("failed to rename file %s. DABs uses resource type as sub extension for generated content, please rename to %s", oldFilename, filename) + + } + saver := yamlsaver.NewSaverWithStyle(map[string]yaml.Style{ // Including all JobSettings and nested fields which are map[string]string type "spark_conf": yaml.DoubleQuotedStyle, diff --git a/cmd/bundle/generate/pipeline.go b/cmd/bundle/generate/pipeline.go index bd973fe0..c7cd5c1d 100644 --- a/cmd/bundle/generate/pipeline.go +++ b/cmd/bundle/generate/pipeline.go @@ -83,7 +83,15 @@ func NewGeneratePipelineCommand() *cobra.Command { 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 { + return fmt.Errorf("failed to rename file %s. DABs uses resource type as sub extension for generated content, please rename to %s", oldFilename, filename) + + } + saver := yamlsaver.NewSaverWithStyle( // Including all PipelineSpec and nested fields which are map[string]string type map[string]yaml.Style{