Repository navigation
Conversation
|
Hey folks, my progress on this fix is pretty humble yet: the majority of numeric functions seems to have been fixed, but I'm still struggling implementing a workaround for comparison functions without a full re-definition of these monsters (https://golang.org/src/text/template/funcs.go#L441). I need to think over how these functions could be overloaded. From a brief look, the problem boils down to finding a way to reference and re-use corresponding citizens of template.builtins. In the meantime, if there are any hints on how it could be wrapped nicely, I'd be super happy to hear these. Thanks in advance! |
764f354 to
57fea3e
Compare
|
My progress so far:
I am planning to work on fixing comparison functions and extending pkg/engine test suite. An ETA for this operation: a couple of days. In the meantime, I'd really appreciate an early code review and feedback: it's super important for me to understand the core team has no strict objections against this approach. If there are objections, another rational solution would be to fully revert my earlier Number-converting patch so 2.15 can be unscrewed. |
c948afa to
53dea97
Compare
|
Recent update on the fix: known reported issues seem to be addressed and fixed by this PR. Waiting for a review from the core team to figure out the next action points. |
d502834 to
a9b2be7
Compare
|
#6721 might be related to the same regression and it has to be tested carefully before this PR could be counted safe to merge. |
a9b2be7 to
e7a2367
Compare
This commit is a fix for the regression introduced in 2.15 with an attempt to carry all numeric values in json.Number container (see helm#6708 for more details). The fix overloads a series of Helm template functions: * int64 * int * float64 * add1 * add * sub * div * mod * mul * max * min * ceil * floor * round * until * untilStep * splitn * abbrev * abbrevboth * trunc * substr * repeat * randAlphaNum * randAlpha * randAscii * randNumeric * wrap * wrapWith * indent * nindent * plural * slice * eq * gt * ge * lt * le * ne Corresponding test cases are included in the engine test suite. Signed-off-by: Oleg Sidorov <[email protected]>
e7a2367 to
9ed8bca
Compare
There was a problem hiding this comment.
thank you for the changes as well as the tests. My concern lies with having to overload every function that involves a numerical value, including any new functions that are introduced by sprig. Can we cast the json.Number to its native type before passing it as a value? That might prevent the need to wrap every function with a call to cast a json.Number to the expected type.
Given the changes involved in this PR, I'd be more inclined to revert the original commit than to introduce this code, and carry forward with a better fix in Helm 3. What do you think about that approach?
|
@bacongobbler I totally agree with you. Indeed, this looks like an overload madness to me as well: a small change that looked good turned to an absolute evil. I'd like to ask for 1 more evening of hacking to see if I can play with values the way you suggested above. If it doesn't work, I'm in favour of reverting the original commit. I'll update this PR shortly. |
This commit reverts changes introduced in helm#6010 due to a massive regression reported in helm#6708. An attempt to fix the problem in helm#6709 seems to be unreasonably clumzy and hacky, therefore reverting the offensive change seems to be the most pragmatic solution. This reverts commits: * 70cd32c. * 9014bd9.
|
Closed in favor of #6749 |
This commit reverts changes introduced in helm#6010 due to a massive regression reported in helm#6708. An attempt to fix the problem in helm#6709 seems to be unreasonably clumzy and hacky, therefore reverting the offensive change seems to be the most pragmatic solution. This reverts commits: * 70cd32c. * 9014bd9. Signed-off-by: Oleg Sidorov <[email protected]>
This commit reverts changes introduced in #6010 due to a massive regression reported in #6708. An attempt to fix the problem in #6709 seems to be unreasonably clumzy and hacky, therefore reverting the offensive change seems to be the most pragmatic solution. This reverts commits: * 70cd32c. * 9014bd9. Signed-off-by: Oleg Sidorov <[email protected]>
What this PR does / why we need it:
This commit is a fix for the regression introduced in 2.15
with an attempt to carry all numeric values in json.Number container
(see #6708 for more details).
The fix overloads a series of Helm template functions:
The PR might need some polishing and refactoring: this is very much a first working fix.
Special notes for your reviewer:
If applicable: