jenkinsci / google-kubernetes-engine-plugin

The Google Kubernetes Engine (GKE) Plugin allows you to deploy build artifacts to Kubernetes clusters running in GKE with Jenkins.
https://plugins.jenkins.io/google-kubernetes-engine/
Apache License 2.0
36 stars 66 forks source link

IllegalArgumentException caused by UnsupportedOperationException when getCluster called #199

Open pawoolley opened 3 years ago

pawoolley commented 3 years ago

Version report

Jenkins 2.263.2 Google Kubernetes Engine Plugin 0.8.3

Red Hat Enterprise Linux release 8.3 (Ootpa)

Reproduction steps

Trying to perform a deployment to GKE using this pipeline:

pipeline {
    agent any
    environment {
        PROJECT_ID = 'my-google-cloud-project-id'
        CLUSTER_NAME = 'my-gke-cluster-name'
        LOCATION = 'us-central1-a'
        CREDENTIALS_ID = 'my-service-account-creds-id'
    }
    stages {
        stage('Deploy to GKE') {
            steps{
                step([
                        $class: 'KubernetesEngineBuilder',
                        projectId: env.PROJECT_ID,
                        clusterName: env.CLUSTER_NAME,
                        location: env.LOCATION,
                        manifestPattern: 'gke-deployment.yaml',
                        credentialsId: env.CREDENTIALS_ID,
                        verifyDeployments: true])
            }
        }
    }
}

Results

The deployment works, with no stacktraces in the logs.

The deployment works, the build succeeds, but there is the following stacktrace repeated in the logs:

2021-06-22 14:07:35.807+0000 [id=53]    WARNING o.j.p.s.d.DescribableParameter#uncoerce: failed to uncoerce com.google.jenkins.plugins.k8sengine.KubernetesEngineBuilder@6f354e72
java.lang.IllegalArgumentException
    at com.google.common.base.Preconditions.checkArgument(Preconditions.java:72)
    at com.google.jenkins.plugins.k8sengine.ClusterUtil.toNameAndLocation(ClusterUtil.java:45)
    at com.google.jenkins.plugins.k8sengine.KubernetesEngineBuilder.getCluster(KubernetesEngineBuilder.java:161)
Caused: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.jenkinsci.plugins.structs.describable.DescribableParameter.getValue(DescribableParameter.java:154)
Caused: java.lang.UnsupportedOperationException
    at org.jenkinsci.plugins.structs.describable.DescribableParameter.getValue(DescribableParameter.java:166)
    at org.jenkinsci.plugins.structs.describable.DescribableParameter.inspect(DescribableParameter.java:142)
    at org.jenkinsci.plugins.structs.describable.DescribableModel.uninstantiate2(DescribableModel.java:682)
    at org.jenkinsci.plugins.structs.describable.DescribableModel.uninstantiate2_(DescribableModel.java:752)
    at org.jenkinsci.plugins.structs.describable.DescribableParameter.uncoerce(DescribableParameter.java:196)
    at org.jenkinsci.plugins.structs.describable.DescribableParameter.inspect(DescribableParameter.java:142)
    at org.jenkinsci.plugins.structs.describable.DescribableModel.uninstantiate2(DescribableModel.java:655)
    at org.jenkinsci.plugins.workflow.actions.ArgumentsAction.resolve(ArgumentsAction.java:306)
    at org.jenkinsci.plugins.workflow.actions.ArgumentsAction.getResolvedArguments(ArgumentsAction.java:293)
    at com.cloudbees.analytics.build_completed.PipelinePropertyCollector$PipelineVisitor.visit(PipelinePropertyCollector.java:154)
    at org.jenkinsci.plugins.workflow.graphanalysis.AbstractFlowScanner.visitAll(AbstractFlowScanner.java:364)
    at org.jenkinsci.plugins.workflow.graphanalysis.AbstractFlowScanner.visitAll(AbstractFlowScanner.java:373)
    at com.cloudbees.analytics.build_completed.PipelinePropertyCollector.processFlowNodes(PipelinePropertyCollector.java:127)
    at com.cloudbees.analytics.build_completed.PipelinePropertyCollector.addProperties(PipelinePropertyCollector.java:75)
    at com.cloudbees.analytics.gatherer.BuildCompletedEvent.getData(BuildCompletedEvent.java:55)
    at com.cloudbees.analytics.Queue.lambda$enqueue$0(Queue.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
shubhamgoel4aug commented 3 years ago

Did you find any workaround to this?

pawoolley commented 3 years ago

Did you find any workaround to this?

No, I did not, but at the time I wasn't in a position to dig in to it either. I raised the bug and had to move on to something else.