Skip to content

Commit

Permalink
Sort kustomize params in GetAppDetails
Browse files Browse the repository at this point in the history
  • Loading branch information
jessesuen committed Mar 5, 2019
1 parent 233708e commit 8d98d6e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 33 deletions.
31 changes: 0 additions & 31 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions reposerver/repository/repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ func TestGetAppDetailsKustomize(t *testing.T) {
Path: "kustomization_yaml",
})
assert.NoError(t, err)
assert.Equal(t, "nginx", res.Kustomize.ImageTags[0].Name)
assert.Equal(t, "1.15.4", res.Kustomize.ImageTags[0].Value)
assert.Equal(t, "k8s.gcr.io/nginx-slim", res.Kustomize.ImageTags[0].Name)
assert.Equal(t, "0.8", res.Kustomize.ImageTags[0].Value)
assert.Equal(t, 2, len(res.Kustomize.ImageTags))
}
4 changes: 4 additions & 0 deletions util/kustomize/kustomize.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"os"
"os/exec"
"path/filepath"
"sort"
"strings"

argoexec "github.com/argoproj/pkg/exec"
Expand Down Expand Up @@ -170,6 +171,9 @@ func getImageParameters(objs []*unstructured.Unstructured) []*v1alpha1.Kustomize
Value: version,
})
}
sort.Slice(params, func(i, j int) bool {
return params[i].Name < params[j].Name
})
return params
}

Expand Down

0 comments on commit 8d98d6e

Please sign in to comment.