jenkinsci / hashicorp-vault-plugin

Jenkins plugin to populate environment variables from secrets stored in HashiCorp's Vault.
https://plugins.jenkins.io/hashicorp-vault-plugin/
MIT License
218 stars 144 forks source link

FATAL: java.io.IOException: Unable to serialize UserRPCRequest:org.jenkinsci.plugins.gitclient.GitClient.addCredentials[java.lang.String,com.cloudbees.plugins.credentials.common.StandardCredentials](3) #222

Open tricketg opened 2 years ago

tricketg commented 2 years ago

Jenkins and plugins versions report

Environment ```text Jenkins: 2.345 OS: Linux - 5.16.18-200.fc35.x86_64 --- ace-editor:1.1 ant:475.vf34069fef73c antisamy-markup-formatter:2.7 apache-httpcomponents-client-4-api:4.5.13-1.0 bootstrap4-api:4.6.0-4 bootstrap5-api:5.1.3-6 bouncycastle-api:2.26 branch-api:2.1046.v0ca_37783ecc5 build-timeout:1.20 caffeine-api:2.9.3-65.v6a_47d0f4d1fe checks-api:1.7.3 cloudbees-folder:6.714.v79e858ef76a_2 command-launcher:1.6 credentials:1126.ve05618c41e62 credentials-binding:523.vd859a_4b_122e6 display-url-api:2.3.6 durable-task:496.va67c6f9eefa7 echarts-api:5.3.2-1 email-ext:2.88 font-awesome-api:6.0.0-1 git:4.11.1 git-client:3.11.0 git-server:1.10 github:1.34.3 github-api:1.303-400.v35c2d8258028 github-branch-source:1598.v91207e9f9b_4a_ gradle:1.38 handlebars:3.0.8 hashicorp-vault-pipeline:1.3 hashicorp-vault-plugin:336.v182c0fbaaeb7 jackson2-api:2.13.2.20220328-273.v11d70a_b_a_1a_52 javax-activation-api:1.2.0-3 javax-mail-api:1.6.2-6 jaxb:2.3.0.1 jdk-tool:1.5 jjwt-api:0.11.2-71.v2722b_b_06a_2a_f jnr-posix-api:3.1.7-3 jquery3-api:3.6.0-3 jsch:0.1.55.2 junit:1.60 ldap:2.9 lockable-resources:2.14 mailer:414.vcc4c33714601 matrix-auth:3.1.1 matrix-project:758.v7a_ea_491852f3 momentjs:1.1.1 okhttp-api:4.9.3-105.vb96869f8ac3a pam-auth:1.7 pipeline-build-step:2.18 pipeline-github-lib:36.v4c01db_ca_ed16 pipeline-graph-analysis:195.v5812d95a_a_2f9 pipeline-input-step:448.v37cea_9a_10a_70 pipeline-milestone-step:101.vd572fef9d926 pipeline-model-api:2.2077.vc78ec45162f1 pipeline-model-definition:2.2077.vc78ec45162f1 pipeline-model-extensions:2.2077.vc78ec45162f1 pipeline-rest-api:2.24 pipeline-stage-step:293.v200037eefcd5 pipeline-stage-tags-metadata:2.2077.vc78ec45162f1 pipeline-stage-view:2.24 plain-credentials:1.8 plugin-util-api:2.16.0 popper-api:1.16.1-3 popper2-api:2.11.5-1 resource-disposer:0.19 scm-api:608.vfa_f971c5a_a_e9 script-security:1158.v7c1b_73a_69a_08 snakeyaml-api:1.30.1 ssh-credentials:277.v95c2fec1c047 ssh-slaves:1.814.vc82988f54b_10 sshd:3.228.v4c9f9e652c86 structs:318.va_f3ccb_729b_71 timestamper:1.17 token-macro:293.v283932a_0a_b_49 trilead-api:1.57.v6e90e07157e1 variant:1.4 workflow-aggregator:2.7 workflow-api:1144.v61c3180fa_03f workflow-basic-steps:948.v2c72a_091b_b_68 workflow-cps:2689.v434009a_31b_f1 workflow-cps-global-lib:570.v21311f4951f8 workflow-durable-task-step:1130.v8fd69d0b_8857 workflow-job:1180.v04c4e75dce43 workflow-multibranch:712.vc169a_1387405 workflow-scm-step:399.v9b_8f4da_65061 workflow-step-api:625.vd896b_f445a_f8 workflow-support:819.v37d707a_71d9b_ ws-cleanup:0.42 ```

What Operating System are you using (both controller, and any agents involved in the problem)?

Test server on my workstation : ilinux : fedora 35 and an agent ilinux..ubuntu Live build server and agents Ubuntu 20.04.4 LTS

Reproduction steps

  1. Create a freestyle jenkins job
  2. Restrict where it can run to a defined agent
  3. in source code management, add a github repository, and for authentication use a defined vault username with private key credential
  4. Run the job

Expected Results

git checkout OK

Actual Results

Failure with following stack trace.

FATAL: java.io.IOException: Unable to serialize UserRPCRequest:org.jenkinsci.plugins.gitclient.GitClient.addCredentials[java.lang.String,com.cloudbees.plugins.credentials.common.StandardCredentials](3)
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](3)
    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.$Proxy72.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 hudson.scm.SCM.checkout(SCM.java:540)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1217)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:647)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:85)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:519)
    at hudson.model.Run.execute(Run.java:1897)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44)
    at hudson.model.ResourceController.execute(ResourceController.java:101)
    at hudson.model.Executor.run(Executor.java:442)
Finished: FAILURE

Anything else?

Running on master/built-in works (ie no serialization involved). Reverting version of plugin hashicorp-vault-plugin from 336.v182c0fbaaeb7 to 3.8 and it works.

Thanks in advance...

romancin commented 2 years ago

Same problem here :( Any workaround you found @tricketg ?

Thank you!

tricketg commented 2 years ago

Sorry, no workaround found, just ensuring we continue to use reverted plugin. :(

isometry commented 2 years ago

This looks like a variation of #201