Use Helm's `base
` function to get folder name
Turns out Helm implements go template function ``base`` that will return last component of a path. Instead of doing that manually in _funcs.tpl, we can leverage the builtin. This commit replaces that. Change-Id: I1b0c90e82790de405730b61ee85654a8810d6907
This commit is contained in:
parent
fb22abdb63
commit
8185104a5c
@ -19,9 +19,7 @@
|
||||
{{- define "helm-toolkit.template" -}}
|
||||
{{- $name := index . 0 -}}
|
||||
{{- $context := index . 1 -}}
|
||||
{{- $v:= $context.Template.Name | split "/" -}}
|
||||
{{- $n := len $v -}}
|
||||
{{- $last := sub $n 1 | printf "_%d" | index $v -}}
|
||||
{{- $last := base $context.Template.Name }}
|
||||
{{- $wtf := $context.Template.Name | replace $last $name -}}
|
||||
{{ include $wtf $context }}
|
||||
{{- end -}}
|
||||
@ -29,9 +27,7 @@
|
||||
{{- define "helm-toolkit.hash" -}}
|
||||
{{- $name := index . 0 -}}
|
||||
{{- $context := index . 1 -}}
|
||||
{{- $v:= $context.Template.Name | split "/" -}}
|
||||
{{- $n := len $v -}}
|
||||
{{- $last := sub $n 1 | printf "_%d" | index $v -}}
|
||||
{{- $last := base $context.Template.Name }}
|
||||
{{- $wtf := $context.Template.Name | replace $last $name -}}
|
||||
{{- include $wtf $context | sha256sum | quote -}}
|
||||
{{- end -}}
|
||||
|
Loading…
Reference in New Issue
Block a user