Repository navigation
feat: Allow .Release.Name to be used in gotmpl values templates - #1424
Conversation
|
Hi, is this something that will be merged in soon? |
|
@Romiko Yes. I'll merge this today or tomorrow, immediately after I've finished stabilizing the latest minor version of Helmfile (v0.125.x). @joshes Thanks for your contribution! This LGTM overall. But please let me modify this before/after merging this a bit, so that it doesn't accidentally expose other ReleaseSpec fields. For example, this change as its current form result in exposing |
|
@mumoshu Sounds good. That side effect did strike me as extremely useful as well initially but I hear what you're saying. :) Thanks! |
| // releaseTemplateData provides variables accessible while executing golang text/template expressions in releases of a helmfile YAML file | ||
| // releaseTemplateData provides variables accessible while executing golang text/template expressions in release templates | ||
| // and release values templates within a Helmfile YAML file. | ||
| type releaseTemplateData struct { |
There was a problem hiding this comment.
@joshes I realized that we already have a struct type for the template data used for rendering anything related to each release! FYI it was used for rendering things like valuesTemplate. So I refactored your change without modifying EnvironmentTemplateData.
Along the way I also realized that we already and unexpectedly exposed ReleaseSpec to the whole template in some case.
Fortunately, Helmfile had unit tests(TestHelmState_executeTemplates) that helped me to figure out which ReleaseSpec fields are intended to be exposed to the template. I extracted the fields to releseTemplateDataRelease(L34-L46).
It was accidentally removed in #1424, and had been unexpectedly unavailable between v0.126.0 and v0.128.1.
This adds the ability to utilize
.Releaseinside of gotmpl files as discussed here.Resolves: #760
Added a simple test that passed once implemented and all tests are running green.