It's initializing org.eclipse.jgit.lib.Repository object in try with resources block and catching the exception thrown in catch block. However, it returns a null value when the exception is caught.
We should be returning an empty map instead of null. We should remove this line as we're already returning Map annotations created in the beginning of the function at the end of method.
Expected Behavior
return null` line is removed from the method
Acceptance Criteria
[x] line 66 containing return null statement is removed
[x] GitEnricherTest should pass after making this change
How to manually test my changes
Kubernetes
If you don't have a real Kubernetes cluster available (most probably), you can use Minikube or Kind to test with a local cluster.
Once you have your Sandbox environment, you'll need to download the oc tool from the cluster console.
(Press the ? icon and from the context menu select Command line tools, you'll be redirected to https://$subdomain.openshiftapps.com/command-lines-tools where you'll be able to download the CLI for your platform)
@rohanKanojia can i pick it up? already returning Map annotations created in the beginning of the function at the end of metho-> Collections.emptyMap() is better option rather here!
Component
JKube Kit
Task description
Description
GitEnricher has this
getAnnotations
method that returns a map of annotations containing Git related information of the project:https://github.com/eclipse/jkube/blob/fddd604457c98a197bd8b2f3cbb3167dde2a9b3d/jkube-kit/enricher/generic/src/main/java/org/eclipse/jkube/enricher/generic/GitEnricher.java#L53-L67
It's initializing
org.eclipse.jgit.lib.Repository
object in try with resources block and catching the exception thrown in catch block. However, it returns anull
value when the exception is caught.https://github.com/eclipse/jkube/blob/fddd604457c98a197bd8b2f3cbb3167dde2a9b3d/jkube-kit/enricher/generic/src/main/java/org/eclipse/jkube/enricher/generic/GitEnricher.java#L66
We should be returning an empty map instead of
null
. We should remove this line as we're already returning Mapannotations
created in the beginning of the function at the end of method.Expected Behavior
return
null` line is removed from the methodAcceptance Criteria
return null
statement is removedHow to manually test my changes
Kubernetes
If you don't have a real Kubernetes cluster available (most probably), you can use Minikube or Kind to test with a local cluster.
OpenShift
If you don't have a real OpenShift cluster available (most probably), you can use Red Hat's developer Sandbox for Red Hat OpenShift. The only requirement is to have a Red Hat account.
Once you have your Sandbox environment, you'll need to download the oc tool from the cluster console. (Press the
?
icon and from the context menu selectCommand line tools
, you'll be redirected to https://$subdomain.openshiftapps.com/command-lines-tools where you'll be able to download the CLI for your platform)