Skip to content

Commit

Permalink
fix: ImageEnricher#mergeEnvVariables causes error for empty env varia…
Browse files Browse the repository at this point in the history
…bles eclipse-jkube#3220

Signed-off-by: Marco Carletti <[email protected]>
  • Loading branch information
mcarlett committed Jul 9, 2024
1 parent bad7998 commit 9df0152
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ private void mergeEnvVariables(Container container) {
EnvVar newEnvVar =
new EnvVarBuilder()
.withName(resourceEnvEntry.getKey())
.withValue(resourceEnvEntry.getValue())
.withValue(Optional.ofNullable(resourceEnvEntry.getValue()).orElse(""))
.build();

EnvVar oldEnvVar = containerEnvVars.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ items:
spec:
containers:
- env:
- name: MY_ENV_empty
- name: MY_ENV_key
value: MY_ENV_value
- name: KUBERNETES_NAMESPACE
Expand Down
1 change: 1 addition & 0 deletions kubernetes-maven-plugin/it/src/it/env-metadata/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<configuration>
<resources>
<env>
<MY_ENV_empty></MY_ENV_empty>
<MY_ENV_key>MY_ENV_value</MY_ENV_key>
<KUBERNETES_NAMESPACE>this_will_not_be_overridden</KUBERNETES_NAMESPACE>
</env>
Expand Down

0 comments on commit 9df0152

Please sign in to comment.