Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

org.eclipse.jkube.enricher.generic.ImageEnricher#mergeEnvVariables causes error for empty env variables #3220

Closed
mcarlett opened this issue Jul 8, 2024 · 0 comments · Fixed by #3221
Assignees
Labels
bug Something isn't working
Milestone

Comments

@mcarlett
Copy link
Contributor

mcarlett commented Jul 8, 2024

Describe the bug

Given a xml configuration in the plugin including empty env variable, the variable is read as null value and it causes

Execution default of goal org.eclipse.jkube:openshift-maven-plugin:1.17-SNAPSHOT:resource failed: Cannot invoke "String.equals(Object)" because the return value of "io.fabric8.kubernetes.api.model.EnvVar.getValue()" is null

Eclipse JKube version

SNAPSHOT

Component

JKube Kit

Apache Maven version

3.8.4

Gradle version

None

Steps to reproduce

  1. in pom.xml configuration
<configuration>
 <resources>
   <env>
     <JAVA_OPTS_APPEND></JAVA_OPTS_APPEND>
   </env>
  </resources>
</configuration>
  1. run oc:resource
    mvn oc:resource

Expected behavior

I'm expecting that the empty env variable can be considered as empty string instead of null or the null is managed in the line where the error is thrown

Runtime

OpenShift

Kubernetes API Server version

other (please specify in additional context)

Environment

Linux

Eclipse JKube Logs

No response

Sample Reproducer Project

No response

Additional context

Kubernetes Version: v1.29.5

the line https://github.com/eclipse-jkube/jkube/blob/master/jkube-kit/enricher/generic/src/main/java/org/eclipse/jkube/enricher/generic/ImageEnricher.java#L295

} else if (!newEnvVar.getValue().equals(oldEnvVar.getValue())) {

will cause the error, since newEnvVar.getValue() is null

@mcarlett mcarlett added the bug Something isn't working label Jul 8, 2024
@manusa manusa added this to the 1.17.0 milestone Jul 9, 2024
mcarlett added a commit to mcarlett/jkube that referenced this issue Jul 9, 2024
…bles eclipse-jkube#3220

Signed-off-by: Marco Carletti <mcarlett@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants