diff --git a/pkg/jx/cmd/install.go b/pkg/jx/cmd/install.go index 8ae5c4db53..1f17ae86bd 100644 --- a/pkg/jx/cmd/install.go +++ b/pkg/jx/cmd/install.go @@ -942,15 +942,9 @@ func (options *InstallOptions) configureHelmValues(namespace string) error { return errors.Wrap(err, "configuring the tiller namespace") } - isProw := false - if options.Flags.GitOpsMode { - isProw = options.Flags.Prow - } else { + isProw := options.Flags.Prow + if !options.Flags.GitOpsMode { options.SetDevNamespace(namespace) - isProw, err = options.isProw() - if err != nil { - return errors.Wrapf(err, "cannot work out if this is a prow based install in namespace %s", options.currentNamespace) - } } if isProw { @@ -959,7 +953,6 @@ func (options *InstallOptions) configureHelmValues(namespace string) error { enableControllerBuild := true helmConfig.ControllerBuild.Enabled = &enableControllerBuild } - return nil } @@ -1036,7 +1029,7 @@ func (options *InstallOptions) getHelmValuesFiles(configStore configio.ConfigSto temporaryFiles = append(temporaryFiles, gitSecretsFileName, extraValuesFileName, cloudEnvironmentSecretsLocation) } - return valuesFiles, secretsFiles, temporaryFiles, nil + return util.FilterFileExists(valuesFiles), util.FilterFileExists(secretsFiles), util.FilterFileExists(temporaryFiles), nil } func (options *InstallOptions) configureGitAuth(gitUserName string, gitServer string, gitAPIToken string) error { diff --git a/pkg/util/files.go b/pkg/util/files.go index 91636c43d1..e74b5e0c45 100644 --- a/pkg/util/files.go +++ b/pkg/util/files.go @@ -351,3 +351,15 @@ func RecreateDirs(dirs ...string) error { } return nil } + +// FilterFileExists filters out files which do not exist +func FilterFileExists(paths []string) []string { + answer := []string{} + for _, path := range paths { + exists, err := FileExists(path) + if exists && err == nil { + answer = append(answer, path) + } + } + return answer +} \ No newline at end of file