I am running jenkins i AKS kubernetes (k8s version 1.22). I have the below jenkinsfile:
podTemplate(label: 'builder',
containers: [
containerTemplate(
name: 'jnlp',
image: 'jenkins/inbound-agent:4.11-1',
args: '${computer.jnlpmac} ${computer.name}'
containerTemplate(name: 'gradle',
image: 'gradle:jdk11',
command: 'cat',
ttyEnabled: true
],
volumes: [
hostPathVolume(hostPath: '/var/run/containerd/containerd.sock', mountPath: '/var/run/containerd/containerd.sock')
],
workspaceVolume: persistentVolumeClaimWorkspaceVolume(claimName: 'my-workspace-pvc', readOnly: false)
) {
node('builder') {
stage('Checkout') {
checkout scm
}
stage('Gradle build') {
container('gradle') {
sh "./gradlew clean build --info"
}
}
}
}
Where I am trying to use the below PVC as the workspace volume:
$ kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
my-workspace-pvc Bound pvc-d58bc5ab-82a0-4cd1-97d8-fcae0bc09bc9 20Gi RWX azurefile-csi-premium 2d18h
But when I run that pipeline I get the following error:
ERROR: [WARNING] Unable to retrieve HOME environment variable
java.io.IOException: Remote call on JNLP4-connect connection from x.x.1.166/x.x.1.166:49036 failed
at hudson.remoting.Channel.call(Channel.java:1005)
at hudson.EnvVars.getRemote(EnvVars.java:436)
at hudson.model.Computer.getEnvironment(Computer.java:1177)
at org.csanchez.jenkins.plugins.kubernetes.KubernetesSlave.checkHomeAndWarnIfNeeded(KubernetesSlave.java:438)
at org.csanchez.jenkins.plugins.kubernetes.KubernetesSlave.createLauncher(KubernetesSlave.java:407)
at org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution$PlaceholderTask$PlaceholderExecutable.run(ExecutorStepExecution.java:799)
at hudson.model.ResourceController.execute(ResourceController.java:99)
at hudson.model.Executor.run(Executor.java:432)
Caused by: java.lang.ClassNotFoundException: Failed to deserialize the Callable object. Perhaps you needed to implement DelegatingCallable?
at hudson.remoting.UserRequest.perform(UserRequest.java:191)
at hudson.remoting.UserRequest.perform(UserRequest.java:54)
at hudson.remoting.Request$2.run(Request.java:376)
at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:122)
at java.base/java.lang.Thread.run(Unknown Source)
Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from x.x.1.166/x.x.1.166:49036
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1797)
at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356)
at hudson.remoting.Channel.call(Channel.java:1001)
at hudson.EnvVars.getRemote(EnvVars.java:436)
at hudson.model.Computer.getEnvironment(Computer.java:1177)
at org.csanchez.jenkins.plugins.kubernetes.KubernetesSlave.checkHomeAndWarnIfNeeded(KubernetesSlave.java:438)
at org.csanchez.jenkins.plugins.kubernetes.KubernetesSlave.createLauncher(KubernetesSlave.java:407)
at org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution$PlaceholderTask$PlaceholderExecutable.run(ExecutorStepExecution.java:799)
at hudson.model.ResourceController.execute(ResourceController.java:99)
at hudson.model.Executor.run(Executor.java:432)
Caused by: java.lang.ClassNotFoundException: hudson.EnvVars$GetEnvVars
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Unknown Source)
at java.base/java.io.ObjectInputStream.resolveClass(Unknown Source)
at hudson.remoting.MultiClassLoaderSerializer$Input.resolveClass(MultiClassLoaderSerializer.java:136)
at java.base/java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.base/java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.base/java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.base/java.io.ObjectInputStream.readObject0(Unknown Source)
at java.base/java.io.ObjectInputStream.readObject(Unknown Source)
at java.base/java.io.ObjectInputStream.readObject(Unknown Source)
at hudson.remoting.UserRequest.deserialize(UserRequest.java:289)
at hudson.remoting.UserRequest.perform(UserRequest.java:189)
... 8 more
[Pipeline] // node
[Pipeline] }
[Pipeline] // podTemplate
[Pipeline] End of Pipeline
java.lang.ClassNotFoundException: hudson.EnvVars$GetEnvVars
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Unknown Source)
at java.base/java.io.ObjectInputStream.resolveClass(Unknown Source)
at hudson.remoting.MultiClassLoaderSerializer$Input.resolveClass(MultiClassLoaderSerializer.java:136)
at java.base/java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.base/java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.base/java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.base/java.io.ObjectInputStream.readObject0(Unknown Source)
at java.base/java.io.ObjectInputStream.readObject(Unknown Source)
at java.base/java.io.ObjectInputStream.readObject(Unknown Source)
at hudson.remoting.UserRequest.deserialize(UserRequest.java:289)
at hudson.remoting.UserRequest.perform(UserRequest.java:189)
Also: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from x.x.1.166/x.x.1.166:49036
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1797)
at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356)
at hudson.remoting.Channel.call(Channel.java:1001)
at hudson.EnvVars.getRemote(EnvVars.java:436)
at hudson.model.Computer.getEnvironment(Computer.java:1177)
at org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution$PlaceholderTask$PlaceholderExecutable.run(ExecutorStepExecution.java:807)
at hudson.model.ResourceController.execute(ResourceController.java:99)
at hudson.model.Executor.run(Executor.java:432)
Caused: java.lang.ClassNotFoundException: Failed to deserialize the Callable object. Perhaps you needed to implement DelegatingCallable?
at hudson.remoting.UserRequest.perform(UserRequest.java:191)
at hudson.remoting.UserRequest.perform(UserRequest.java:54)
at hudson.remoting.Request$2.run(Request.java:376)
at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:122)
at java.base/java.lang.Thread.run(Unknown Source)
Caused: java.io.IOException: Remote call on JNLP4-connect connection from x.x.1.166/x.x.1.166:49036 failed
at hudson.remoting.Channel.call(Channel.java:1005)
at hudson.EnvVars.getRemote(EnvVars.java:436)
at hudson.model.Computer.getEnvironment(Computer.java:1177)
at org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution$PlaceholderTask$PlaceholderExecutable.run(ExecutorStepExecution.java:807)
at hudson.model.ResourceController.execute(ResourceController.java:99)
at hudson.model.Executor.run(Executor.java:432)
Finished: FAILURE
What am I missing??