feat: execute templates against postRendererHooks#1839
Conversation
0638e23 to
f8242eb
Compare
|
I haven't added tests to the merging part, cause I wasn't sure, whether it's the right way to handle it at all |
|
@allanger please fix lint issue. |
|
Also, if the merging of the postRendererHooks args seems fine for you, it makes sense to clean up the Another problem would be the args that are coming from the CLI, they are not templated at all, because I couldn't find a place where I can access both State and Args before templating, as it was the first time I've seen the code, and most probably, I just couldn't follow it. |
f636b67 to
b202cd9
Compare
b202cd9 to
974c4b1
Compare
974c4b1 to
475705f
Compare
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
Is there a chance that we can get it going? |
|
@allanger please fix ci issue. |
|
@yxxhero This is the failed job: https://github.com/helmfile/helmfile/actions/runs/12675728241/job/35327605145#step:9:2044. and there is nothing I can do about it, I believe, we only can re-run And the next runs are failing because the artifact is not available anymore. May I ask you to trigger the whole pipeline again, including the successful jobs? |
This commit is supposed to add template support to post renderer args. Also, to make it possible to template arguments that are added to helm defaults, during the load, I'm removing default post renderer args from the state and putting them to each release, unless custom args are defined for the release. Signed-off-by: Nikolai Rodionov <[email protected]>
475705f to
c5d4441
Compare
This commit is supposed to add template support to post renderer args. Also, to make it possible to template arguments that are added to helm defaults, during the load, I'm removing default post renderer args from the state and putting them to each release, unless custom args are defined for the release.
Why do I need it?
I'm trying to implement some kind of audit log to the helmfile. The idea is pretty simple, I'm adding a configmap that contains an information that can be used to identify a person that has sync the release via helmfile. In the first implementation, I was using subcharts with some
.Release.Setfields, added via templates, so I could just add a release like thatBut from time to time, it's violating chart's values schemas, and also it needs to be enabled per-release, that I consider error-prone.
So I had an idea to use postRendererHooks for that, but I couldn't find a way to access a Release Name from the hook, and that's why I came up with this PR.
Example:
This script is supposed to take the first argument and use it for the resource name.
I have
helmDefaultsset like this:And then the result is
Why am I merging
.HelmDefaults.PostRendererArgsto the.Release.PostRendererArgs. To avoid adding the args entry to each release, I need to merge all the args before templating, so I can access the release Data in the Args that are defined globally.