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

Getting NullPointerException com.bettercloud.vault.api.Logical.read after upgrade to 2.3.0

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Blocker Blocker
    • hashicorp-vault-plugin
    • None
    • Plugin: 2.3.0
      Java: 1.8.0_202
      Jenkins: 2.187-1.1
      EL7

      Getting this after upgrade to 2.3.0

      java.lang.NullPointerException
      	at com.bettercloud.vault.api.Logical.read(Logical.java:73)
      	at com.datapipe.jenkins.vault.VaultAccessor.read(VaultAccessor.java:52)
      	at com.datapipe.jenkins.vault.VaultBuildWrapper.provideEnvironmentVariablesFromVault(VaultBuildWrapper.java:137)
      	at com.datapipe.jenkins.vault.VaultBuildWrapper.setUp(VaultBuildWrapper.java:90)
      	at jenkins.tasks.SimpleBuildWrapper.setUp(SimpleBuildWrapper.java:146)
      	at hudson.model.Build$BuildExecution.doRun(Build.java:157)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
      	at hudson.model.Run.execute(Run.java:1815)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      	at hudson.model.ResourceController.execute(ResourceController.java:97)
      	at hudson.model.Executor.run(Executor.java:429)
      

      using Vault app role and Vault Plugin to get secrets to shell build step. Downgrade back to 2.2.0 helps.

          [JENKINS-58991] Getting NullPointerException com.bettercloud.vault.api.Logical.read after upgrade to 2.3.0

          vadamec if you could share your pipeline step or UI step.

          What most likely is the case is you have not set `engineVersion`

          Joseph Petersen (old) added a comment - vadamec if you could share your pipeline step or UI step. What most likely is the case is you have not set `engineVersion`

          Upgrading to v2.3.1 allows you to set your vault engine on the Vault Configuration.
          It will default to version 2 so if it still fails you will most likely have to set it to version 1.

          If you want to know more about engine version read here: https://www.vaultproject.io/docs/secrets/kv/index.html

          Joseph Petersen (old) added a comment - Upgrading to v2.3.1 allows you to set your vault engine on the Vault Configuration. It will default to version 2 so if it still fails you will most likely have to set it to version 1. If you want to know more about engine version read here: https://www.vaultproject.io/docs/secrets/kv/index.html

          Vaclav Adamec added a comment -

          2.3.1 seems to be ok, maybe it will be better to have engine in global setup, what do you think ?

          Vaclav Adamec added a comment - 2.3.1 seems to be ok, maybe it will be better to have engine in global setup, what do you think ?

          in 2.3.1 engine version can be set on secret, job, folder, and on global check under advanced

          Joseph Petersen (old) added a comment - in 2.3.1 engine version can be set on secret, job, folder, and on global check under advanced

          Vaclav Adamec added a comment -

          just find it, hidden in advance  thanks

          Vaclav Adamec added a comment - just find it, hidden in advance  thanks

          Micheal Waltz added a comment - - edited

          We just started getting this issue again after updating to Jenkins 2.204.2 and the Hashicorp Vault Plugin (https://github.com/jenkinsci/hashicorp-vault-plugin) from 2.5.0 to 3.1.1. Error is,

          FATAL: nulljava.lang.NullPointerException	at com.datapipe.jenkins.vault.VaultBuildWrapper.provideEnvironmentVariablesFromVault(VaultBuildWrapper.java:139)	at com.datapipe.jenkins.vault.VaultBuildWrapper.setUp(VaultBuildWrapper.java:94)	at jenkins.tasks.SimpleBuildWrapper.setUp(SimpleBuildWrapper.java:146)	at hudson.model.Build$BuildExecution.doRun(Build.java:157)	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)	at hudson.model.Run.execute(Run.java:1853)	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)	at hudson.model.ResourceController.execute(ResourceController.java:97)	at hudson.model.Executor.run(Executor.java:427) 

          We've rolledback the plugin to 2.5.0 but it still occurs. Verified the Global jenkins-plugin is set to KV Engine Version 1, and all the jobs are set to 1 as well. Vault server version is 1.0.2 and KV 2 is not enabled.

          Oddly this only happens with triggered jobs: timer, github push/PR, triggered from another job. Running or re-building a job manually will not have this error. I opened an issue in the hashicorp-vault-plugin Github as well for this: https://github.com/jenkinsci/hashicorp-vault-plugin/issues/81

          Other information:

          • Jenkins Master OS: Ubuntu 18.04.4
          • Jenkins Version: 2.204.2
          • Vault Plugin Version: 2.5.0 and 3.1.1
          • Java version: OpenJDK Runtime Environment (build 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08)
          • Vault Server version: 1.0.2
          • Jenkins jobs all run on remote jenkins agents using swarm plugin version 3.18 and Java 1.8.0-8u242 on Ubuntu 18.04

           

          Micheal Waltz added a comment - - edited We just started getting this issue again after updating to Jenkins 2.204.2 and the Hashicorp Vault Plugin ( https://github.com/jenkinsci/hashicorp-vault-plugin ) from 2.5.0 to 3.1.1. Error is, FATAL: nulljava.lang.NullPointerException at com.datapipe.jenkins.vault.VaultBuildWrapper.provideEnvironmentVariablesFromVault(VaultBuildWrapper.java:139) at com.datapipe.jenkins.vault.VaultBuildWrapper.setUp(VaultBuildWrapper.java:94) at jenkins.tasks.SimpleBuildWrapper.setUp(SimpleBuildWrapper.java:146) at hudson.model.Build$BuildExecution.doRun(Build.java:157) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504) at hudson.model.Run.execute(Run.java:1853) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:427) We've rolledback the plugin to 2.5.0 but it still occurs. Verified the Global jenkins-plugin is set to KV Engine Version 1, and all the jobs are set to 1 as well. Vault server version is 1.0.2 and KV 2 is not enabled. Oddly this only happens with triggered jobs: timer, github push/PR, triggered from another job. Running or re-building a job manually will not have this error. I opened an issue in the hashicorp-vault-plugin Github as well for this: https://github.com/jenkinsci/hashicorp-vault-plugin/issues/81 Other information: Jenkins Master OS: Ubuntu 18.04.4 Jenkins Version: 2.204.2 Vault Plugin Version: 2.5.0 and 3.1.1 Java version: OpenJDK Runtime Environment (build 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08) Vault Server version: 1.0.2 Jenkins jobs all run on remote jenkins agents using swarm plugin version 3.18 and Java 1.8.0-8u242 on Ubuntu 18.04  

          Alex E added a comment -

          Have the same error in plugin ver. 3.4.1 on Jenkins LTS (2.222.2) and latest (2.238). I'm trying to use an SSH key from Vault in Git plugin, and it fails with the following exception:

          java.lang.NullPointerException
                  at com.bettercloud.vault.api.Logical.read(Logical.java:75)
                  at com.datapipe.jenkins.vault.VaultAccessor.read(VaultAccessor.java:90)
                  at com.datapipe.jenkins.vault.credentials.common.VaultHelper$SecretRetrieve.call(VaultHelper.java:121)
          Caused: java.lang.RuntimeException
                  at com.datapipe.jenkins.vault.credentials.common.VaultHelper$SecretRetrieve.call(VaultHelper.java:132)
                  at com.datapipe.jenkins.vault.credentials.common.VaultHelper.getVaultSecret(VaultHelper.java:44)
                  at com.datapipe.jenkins.vault.credentials.common.VaultSSHUserPrivateKeyImpl.getPrivateKey(VaultSSHUserPrivateKeyImpl.java:113)
                  at com.datapipe.jenkins.vault.credentials.common.VaultSSHUserPrivateKeyImpl.getPrivateKeys(VaultSSHUserPrivateKeyImpl.java:119)
                  at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.createSshKeyFile(CliGitAPIImpl.java:2060)
                  at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1970)
                  at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1944)
                  at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1935)
                  at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getHeadRev(CliGitAPIImpl.java:3262)
                  at hudson.plugins.git.GitSCM.compareRemoteRevisionWithImpl(GitSCM.java:711)
                  at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:670)
                  at hudson.scm.SCM.compareRemoteRevisionWith(SCM.java:401)
                  at hudson.scm.SCM.poll(SCM.java:418)
                  at hudson.model.AbstractProject._poll(AbstractProject.java:1388)
                  at hudson.model.AbstractProject.poll(AbstractProject.java:1291)
                  at jenkins.triggers.SCMTriggerItem$SCMTriggerItems$Bridge.poll(SCMTriggerItem.java:143)
                  at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:605)
                  at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:651)
                  at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:119)
                  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
                  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
                  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
                  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
                  at java.lang.Thread.run(Thread.java:748)
          

          Alex E added a comment - Have the same error in plugin ver. 3.4.1 on Jenkins LTS (2.222.2) and latest (2.238). I'm trying to use an SSH key from Vault in Git plugin, and it fails with the following exception: java.lang.NullPointerException at com.bettercloud.vault.api.Logical.read(Logical.java:75) at com.datapipe.jenkins.vault.VaultAccessor.read(VaultAccessor.java:90) at com.datapipe.jenkins.vault.credentials.common.VaultHelper$SecretRetrieve.call(VaultHelper.java:121) Caused: java.lang.RuntimeException at com.datapipe.jenkins.vault.credentials.common.VaultHelper$SecretRetrieve.call(VaultHelper.java:132) at com.datapipe.jenkins.vault.credentials.common.VaultHelper.getVaultSecret(VaultHelper.java:44) at com.datapipe.jenkins.vault.credentials.common.VaultSSHUserPrivateKeyImpl.getPrivateKey(VaultSSHUserPrivateKeyImpl.java:113) at com.datapipe.jenkins.vault.credentials.common.VaultSSHUserPrivateKeyImpl.getPrivateKeys(VaultSSHUserPrivateKeyImpl.java:119) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.createSshKeyFile(CliGitAPIImpl.java:2060) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1970) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1944) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1935) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getHeadRev(CliGitAPIImpl.java:3262) at hudson.plugins.git.GitSCM.compareRemoteRevisionWithImpl(GitSCM.java:711) at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:670) at hudson.scm.SCM.compareRemoteRevisionWith(SCM.java:401) at hudson.scm.SCM.poll(SCM.java:418) at hudson.model.AbstractProject._poll(AbstractProject.java:1388) at hudson.model.AbstractProject.poll(AbstractProject.java:1291) at jenkins.triggers.SCMTriggerItem$SCMTriggerItems$Bridge.poll(SCMTriggerItem.java:143) at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:605) at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:651) at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:119) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang. Thread .run( Thread .java:748)

            jetersen Joseph Petersen
            vadamec Vaclav Adamec
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: