jenkinsci / jenkinsci/google-kubernetes-engine-plugin
Better error message when target cluster is misconfigured or missing functionality
- Dominant language
- Java
- Stars
- 36
- Forks
- 65
- PR merge metrics
- No merged PRs in 30d
Description
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
```
Contributor guide
Research direction
Start with the stack trace in KubeConfig.java, especially fromCluster at line 153 through user at line 193, and inspect how KubernetesEngineBuilder.java invokes it at line 196. Reproduce deployment against a cluster without client certificates or legacy authentication, then make the failure report a helpful configuration error instead of a NullPointerException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- google-cloud, java, kubernetes
- Domain
- cloud, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100