jenkinsci / kubernetes-cli-plugin

Allows you to setup kubectl to access Kubernetes clusters from your Jenkins jobs.
https://plugins.jenkins.io/kubernetes-cli/
Apache License 2.0
89 stars 48 forks source link

Plugin breaks when using kubernetes-client-api:5.4.1 #85

Closed acelorio closed 3 years ago

acelorio commented 3 years ago

Version report

Jenkins and plugins versions report:

Jenkins: 2.289.1 OS: Linux - 4.18.0-240.22.1.el8_3.x86_64

[...] kubernetes-client-api:5.4.1 kubernetes-credentials:0.9.0 kubernetes:1.30.0 kubernetes-cli:1.10.2 [...] [abridged for clarity]

Reproduction steps

java.lang.NoClassDefFoundError: io/fabric8/kubernetes/api/builder/Predicate
    at org.jenkinsci.plugins.kubernetes.cli.kubeconfig.KubeConfigWriter.hasContext(KubeConfigWriter.java:88)
    at org.jenkinsci.plugins.kubernetes.cli.kubeconfig.KubeConfigWriter.existingOrNewContext(KubeConfigWriter.java:80)
    at org.jenkinsci.plugins.kubernetes.cli.kubeconfig.KubeConfigWriter.setContextNamespace(KubeConfigWriter.java:72)
    at org.jenkinsci.plugins.kubernetes.cli.kubeconfig.KubeConfigWriter.completeConfigBuilder(KubeConfigWriter.java:150)
    at org.jenkinsci.plugins.kubernetes.cli.kubeconfig.KubeConfigWriter.getConfigBuilder(KubeConfigWriter.java:140)
    at org.jenkinsci.plugins.kubernetes.cli.kubeconfig.KubeConfigWriter.writeKubeConfig(KubeConfigWriter.java:119)
    at org.jenkinsci.plugins.kubernetes.cli.GenericBuildStep.start(GenericBuildStep.java:46)
        ...

The new kubernetes-plugin 1.3.0 has pulled in this new kubernetes-client-api:5.4.1, breaking this plugin via kubernetes-credentials

Results

Expected result:

Before the upgrade to 5.4.1, withKubeConfig would work seamlessly

Actual result:

NoClassDefFoundError

maxlaverse commented 3 years ago

Hi @acelorio, Thanks for reporting this bug. I won't have a lot of time to spend behind the keyboard in the next couple of days, therefore I'm looking for an eventual quick fix until https://github.com/jenkinsci/kubernetes-credentials-plugin/pull/35 is merged.

Any chance you try out https://github.com/jenkinsci/kubernetes-cli-plugin/pull/86 ?

Thanks

acelorio commented 3 years ago

86 seems to work like a charm! Thanks!!

maxlaverse commented 3 years ago

I merged the branch and released kubernetes-cli in version 1.10.3. I tested it once more alongside the kubernetes plugin in a fresh installation and had no error.

Please let me know if you have any problem with it @acelorio

acelorio commented 3 years ago

1.10.3 fixed the issue as far as I can see. Thanks! I think you can close this now.