Skip to content

Commit

Permalink
fix: for prow configuration and missing yaml files
Browse files Browse the repository at this point in the history
  • Loading branch information
jstrachan committed Dec 8, 2018
1 parent 809062a commit 754096e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
13 changes: 3 additions & 10 deletions pkg/jx/cmd/install.go
Expand Up @@ -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 {
Expand All @@ -959,7 +953,6 @@ func (options *InstallOptions) configureHelmValues(namespace string) error {
enableControllerBuild := true
helmConfig.ControllerBuild.Enabled = &enableControllerBuild
}

return nil
}

Expand Down Expand Up @@ -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 {
Expand Down
12 changes: 12 additions & 0 deletions pkg/util/files.go
Expand Up @@ -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
}

0 comments on commit 754096e

Please sign in to comment.