Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-68481

Retrieving SSH private key stored in Hashicorp Vault results in serialisation error

XMLWordPrintable

      I have `Vault SSH Username with private key Credential` stored in Jenkins, which is used successfully by other pipelines and plugins. When trying to access the SSH key via Git client plugin, I get an error

      java.io.NotSerializableException: hudson.model.Hudson
      	at java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1185)
      	at java.base/java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1553)
      	at java.base/java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1510)
      	at java.base/java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1433)
      	at java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1179)
      	at java.base/java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1379)
      	at java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1175)
      	at java.base/java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1553)
      	at java.base/java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1510)
      	at java.base/java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1433)
      	at java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1179)
      	at java.base/java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:349)
      	at hudson.remoting.UserRequest._serialize(UserRequest.java:263)
      	at hudson.remoting.UserRequest.serialize(UserRequest.java:272)
      Caused: java.io.IOException: Unable to serialize UserRPCRequest:org.jenkinsci.plugins.gitclient.GitClient.addCredentials[java.lang.String,com.cloudbees.plugins.credentials.common.StandardCredentials](180)
      	at hudson.remoting.UserRequest.serialize(UserRequest.java:274)
      	at hudson.remoting.UserRequest.<init>(UserRequest.java:101)
      	at hudson.remoting.Channel.call(Channel.java:998)
      	at hudson.remoting.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:285)
      Caused: hudson.remoting.RemotingSystemException
      	at hudson.remoting.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:301)
      	at com.sun.proxy.$Proxy104.addCredentials(Unknown Source)
      	at org.jenkinsci.plugins.gitclient.RemoteGitImpl.addCredentials(RemoteGitImpl.java:199)
      	at hudson.plugins.git.GitSCM.createClient(GitSCM.java:919)
      	at hudson.plugins.git.GitSCM.createClient(GitSCM.java:837)
      	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1283)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:129)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:97)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:84)
      	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
      	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
      	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      	at java.base/java.lang.Thread.run(Thread.java:829)
      Finished: FAILURE 

      When using different credential type for the SSH key (SSH Username with private key) - it works well. I tried adding passphrase, changing the key.

      Please let me know if there is anything you could help with. 

      Kind regards,
      Artjom Averin

            Unassigned Unassigned
            a_averin Artjom Averin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: