google-kubernetes-engine-plugin icon indicating copy to clipboard operation
google-kubernetes-engine-plugin copied to clipboard

Better error message when target cluster is misconfigured or missing functionality

Open viglesiasce opened this issue 6 years ago • 0 comments

When deploying to a cluster without client certs or legacy authentication enabled, the build results in an NPE rather than a helpful error message:

Started by user admin
Agent default-k398b is provisioned from template Kubernetes Pod Template
Agent specification [Kubernetes Pod Template] (default): 

Building remotely on default-k398b (default) in workspace /home/jenkins/workspace/test
No credentials specified
Cloning the remote Git repository
Cloning repository https://github.com/viglesiasce/sample-app
 > git init /home/jenkins/workspace/test # timeout=10
Fetching upstream changes from https://github.com/viglesiasce/sample-app
 > git --version # timeout=10
 > git fetch --tags --force --progress https://github.com/viglesiasce/sample-app +refs/heads/*:refs/remotes/origin/* # timeout=10
 > git config remote.origin.url https://github.com/viglesiasce/sample-app # timeout=10
 > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
 > git config remote.origin.url https://github.com/viglesiasce/sample-app # timeout=10
Fetching upstream changes from https://github.com/viglesiasce/sample-app
 > git fetch --tags --force --progress https://github.com/viglesiasce/sample-app +refs/heads/*:refs/remotes/origin/* # timeout=10
 > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
 > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision 8834988fcdc3d6878b5ca6a4fcee4688da7c7597 (refs/remotes/origin/master)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 8834988fcdc3d6878b5ca6a4fcee4688da7c7597 # timeout=10
Commit message: "Simplify Jenkinsfile"
 > git rev-list --no-walk 8834988fcdc3d6878b5ca6a4fcee4688da7c7597 # timeout=10
ERROR: Build step failed with exception
java.lang.NullPointerException: null value
	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:204)
	at com.google.common.collect.ImmutableMap.entryOf(ImmutableMap.java:139)
	at com.google.common.collect.ImmutableMap$Builder.put(ImmutableMap.java:178)
	at com.google.jenkins.plugins.k8sengine.KubeConfig.user(KubeConfig.java:193)
	at com.google.jenkins.plugins.k8sengine.KubeConfig.fromCluster(KubeConfig.java:153)
	at com.google.jenkins.plugins.k8sengine.KubernetesEngineBuilder.perform(KubernetesEngineBuilder.java:196)
	at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:81)
	at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
	at hudson.model.Build$BuildExecution.build(Build.java:206)
	at hudson.model.Build$BuildExecution.doRun(Build.java:163)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
	at hudson.model.Run.execute(Run.java:1816)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:97)
	at hudson.model.Executor.run(Executor.java:429)
Build step 'Deploy to Google Kubernetes Engine' marked build as failure
Finished: FAILURE

viglesiasce avatar May 01 '19 17:05 viglesiasce