Skip to content

Commit

Permalink
Merge pull request #890 from replicatedhq/generic-kots-error
Browse files Browse the repository at this point in the history
Fix generic kustomize error during kots pull release
  • Loading branch information
emosbaugh committed Jul 31, 2020
2 parents 39a1938 + 7d7a9b8 commit 87acd16
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
5 changes: 2 additions & 3 deletions kotsadm/pkg/downstream/diff.go
Expand Up @@ -10,7 +10,6 @@ import (

"github.com/marccampbell/yaml-toolbox/pkg/splitter"
"github.com/pkg/errors"
"github.com/replicatedhq/kots/kotsadm/pkg/logger"
"github.com/sergi/go-diff/diffmatchpatch"
)

Expand Down Expand Up @@ -52,14 +51,14 @@ func DiffAppVersionsForDownstream(downstreamName string, archive string, diffBas
archiveOutput, err := exec.Command(fmt.Sprintf("kustomize%s", kustomizeVersion), "build", filepath.Join(archive, "overlays", "downstreams", downstreamName)).Output()
if err != nil {
if ee, ok := err.(*exec.ExitError); ok {
logger.Errorf("kustomize stderr: %q", string(ee.Stderr))
err = fmt.Errorf("kustomize stderr: %q", string(ee.Stderr))
}
return nil, errors.Wrap(err, "failed to run kustomize on archive dir")
}
baseOutput, err := exec.Command(fmt.Sprintf("kustomize%s", kustomizeVersion), "build", filepath.Join(diffBasePath, "overlays", "downstreams", downstreamName)).Output()
if err != nil {
if ee, ok := err.(*exec.ExitError); ok {
logger.Errorf("kustomize stderr: %q", string(ee.Stderr))
err = fmt.Errorf("kustomize stderr: %q", string(ee.Stderr))
}
return nil, errors.Wrap(err, "failed to run kustomize on base dir")
}
Expand Down
13 changes: 6 additions & 7 deletions kotsadm/pkg/gitops/gitops.go
Expand Up @@ -15,7 +15,6 @@ import (

"github.com/pkg/errors"
"github.com/replicatedhq/kots/kotsadm/pkg/kotsutil"
"github.com/replicatedhq/kots/kotsadm/pkg/logger"
"github.com/replicatedhq/kots/pkg/crypto"
"golang.org/x/crypto/ssh"
"gopkg.in/src-d/go-git.v4"
Expand Down Expand Up @@ -225,11 +224,11 @@ func UpdateDownstreamGitOps(appID, clusterID, uri, branch, path, format, action

appKey := fmt.Sprintf("%s-%s", appID, clusterID)
newAppData := map[string]string{
"repoUri": uri,
"branch": branch,
"path": path,
"format": format,
"action": action,
"repoUri": uri,
"branch": branch,
"path": path,
"format": format,
"action": action,
}

// check if to reset or keep last error
Expand Down Expand Up @@ -326,7 +325,7 @@ func CreateGitOpsCommit(gitOpsConfig *GitOpsConfig, appSlug string, appName stri
out, err := cmd.Output()
if err != nil {
if ee, ok := err.(*exec.ExitError); ok {
logger.Errorf("kustomize stderr: %q", string(ee.Stderr))
err = fmt.Errorf("kustomize stderr: %q", string(ee.Stderr))
}
return "", errors.Wrap(err, "failed to run kustomize")
}
Expand Down
2 changes: 1 addition & 1 deletion kotsadm/pkg/handlers/rendered_contents.go
Expand Up @@ -87,7 +87,7 @@ func GetAppRenderedContents(w http.ResponseWriter, r *http.Request) {
archiveOutput, err := exec.Command(fmt.Sprintf("kustomize%s", kotsKinds.KustomizeVersion()), "build", kustomizeBuildTarget).Output()
if err != nil {
if ee, ok := err.(*exec.ExitError); ok {
logger.Errorf("kustomize stderr: %q", string(ee.Stderr))
err = fmt.Errorf("kustomize stderr: %q", string(ee.Stderr))
}
logger.Error(err)
w.WriteHeader(500)
Expand Down

0 comments on commit 87acd16

Please sign in to comment.