Skip to content

Commit

Permalink
fix(helm): support floating point override values in values files
Browse files Browse the repository at this point in the history
before this, the values file would contain a string, even if rawOverrides is true.

In other words, `--set my-override=1.234` would become
```
my-override: "1.234"
```

After this change, it's:
```
my-override: 1.234
```
  • Loading branch information
dbyron-sf committed Jan 26, 2025
1 parent 88193c8 commit a0da916
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,13 @@ private Object typedVal(String value) {
try {
return Long.parseLong(value);
} catch (NumberFormatException e) {
// Not a Long, return the string itself
// Not a Long, let's see if it's a Double
}

try {
return Double.parseDouble(value);
} catch (NumberFormatException e) {
// Not a Double either, return the string itself.
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ private static Stream<Arguments> helmParseArgs() {
Map.of("name1", Map.of("name2", Arrays.asList(null, Map.of("foo", "bar")))),
true),
Arguments.of("key[0]=value,key=value", Map.of("key", "value"), true),
Arguments.of("key1.key2=value,key1=value", Map.of("key1", "value"), true));
Arguments.of("key1.key2=value,key1=value", Map.of("key1", "value"), true),
Arguments.of("key=1.234", Map.of("key", "1.234"), true),
Arguments.of("key=1.234", Map.of("key", 1.234), false));
}

private static Stream<Arguments> helmParseArgsError() {
Expand Down

0 comments on commit a0da916

Please sign in to comment.