Skip to content

Commit 3b961f0

Browse files
committed
fix: prevent generated update in devspace command building
1 parent dd78da8 commit 3b961f0

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

cmd/run.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ devspace --dependency my-dependency run any-command --any-command-flag
9696
},
9797
}
9898

99-
logger := f.GetLog()
100-
commands, _ := getCommands(f, logger)
99+
commands, _ := getCommands(f)
101100
for _, command := range commands {
102101
description := command.Description
103102
if description == "" {
@@ -200,7 +199,7 @@ func (cmd *RunCmd) RunRun(f factory.Factory, args []string) error {
200199
return dependency.ExecuteCommand(commands, args[0], args[1:], cmd.Stdout, cmd.Stderr)
201200
}
202201

203-
func getCommands(f factory.Factory, logger log.Logger) ([]*latest.CommandConfig, error) {
202+
func getCommands(f factory.Factory) ([]*latest.CommandConfig, error) {
204203
// get current working dir
205204
cwd, err := os.Getwd()
206205
if err != nil {
@@ -222,7 +221,7 @@ func getCommands(f factory.Factory, logger log.Logger) ([]*latest.CommandConfig,
222221
}
223222

224223
// Parse commands
225-
commandsInterface, err := configLoader.LoadWithParser(loader.NewCommandsParser(), nil, log.Discard)
224+
commandsInterface, err := configLoader.LoadWithParser(loader.NewCommandsParser(), &loader.ConfigOptions{Dry: true}, log.Discard)
226225
if err != nil {
227226
return nil, err
228227
}

pkg/devspace/config/loader/loader.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,12 @@ func (l *configLoader) parseConfig(absPath string, rawConfig map[interface{}]int
342342
return nil, nil, nil, err
343343
}
344344

345+
// check if we do not want to change the generated config or
346+
// secret vars.
347+
if options.Dry {
348+
return latestConfig, generatedConfig, resolver, nil
349+
}
350+
345351
// Save generated config
346352
if options.GeneratedLoader == nil {
347353
err = generated.NewConfigLoaderFromDevSpacePath(GetLastProfile(options.Profiles), l.configPath).Save(generatedConfig)

pkg/devspace/config/loader/options.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ func OptionsWithGeneratedConfig(generatedConfig *generated.Config) *ConfigOption
1414

1515
// ConfigOptions defines options to load the config
1616
type ConfigOptions struct {
17+
Dry bool
18+
1719
// KubeClient is needed if variables were saved in the namespace
1820
KubeClient kubectl.Client `yaml:"-" json:"-"`
1921

0 commit comments

Comments
 (0)