Compare using only filepath.Match

Signed-off-by: Mario Valderrama <woldy401@gmail.com>
pull/7816/head
Mario Valderrama 6 years ago
parent f1cc28effa
commit 9374cf5e0e

@ -114,15 +114,7 @@ func newTemplateCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
// if the filepath provided matches a manifest path in the
// chart, render that manifest
if strings.HasSuffix(f, "*") {
if matched, _ := filepath.Match(f, manifestPath); !matched {
continue
}
} else if strings.HasSuffix(f, "/") {
if dir, _ := filepath.Split(manifestPath); f != dir {
continue
}
} else if f != manifestPath {
if matched, _ := filepath.Match(f, manifestPath); !matched {
continue
}
manifestsToRender = append(manifestsToRender, manifest)

@ -94,13 +94,6 @@ func TestTemplateCmd(t *testing.T) {
cmd: fmt.Sprintf("template '%s' --show-only templates/service.yaml --show-only charts/subcharta/templates/service.yaml", chartPath),
golden: "output/template-show-only-multiple.txt",
},
{
name: "template with show-only directory",
cmd: fmt.Sprintf("template '%s' --show-only templates/subdir/", chartPath),
golden: "output/template-show-only-directory.txt",
// Repeat to ensure manifest ordering regressions are caught
repeat: 10,
},
{
name: "template with show-only glob",
cmd: fmt.Sprintf("template '%s' --show-only templates/subdir/role*", chartPath),

@ -1,29 +0,0 @@
---
# Source: subchart1/templates/subdir/serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: subchart1-sa
---
# Source: subchart1/templates/subdir/role.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: subchart1-role
rules:
- resources: ["*"]
verbs: ["get","list","watch"]
---
# Source: subchart1/templates/subdir/rolebinding.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: subchart1-binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: subchart1-role
subjects:
- kind: ServiceAccount
name: subchart1-sa
namespace: default
Loading…
Cancel
Save