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

Calling SoftwareTrustManagerSetup() causes java.lang.IllegalStateException: Jenkins.instance is missing

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • None

      Following the instructions at https://docs.digicert.com/en/software-trust-manager/ci-cd-integrations/plugins/jenkins-plugin-for-keypair-signing.html

       

      When the pipeline runs:

        stage('Set Up Software Trust Manager') { 
          steps { 
            SoftwareTrustManagerSetup() 
          }
        }
      

      It throws an exception:

      hudson.remoting.ProxyException: java.lang.IllegalStateException: Jenkins.instance is missing. Read the documentation of Jenkins.getInstanceOrNull to see what you are doing wrong.
      at jenkins.model.Jenkins.get(Jenkins.java:824)
      at io.jenkins.plugins.digicert.AgentInfo.getCredential(AgentInfo.java:45)
      at io.jenkins.plugins.digicert.AgentInfo.getValue(AgentInfo.java:51)
      at io.jenkins.plugins.digicert.AgentInfo.call(AgentInfo.java:64)
      at io.jenkins.plugins.digicert.AgentInfo.call(AgentInfo.java:25)
      at hudson.remoting.UserRequest.perform(UserRequest.java:211)
      at hudson.remoting.UserRequest.perform(UserRequest.java:54)
      at hudson.remoting.Request$2.run(Request.java:377)
      at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
      at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
      at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:137)
      at java.base/java.lang.Thread.run(Thread.java:1583)

       

      Start of Jenkins file is:

       

      pipeline {
        agent {
          node {
            label 'windows'
          }
        }
        environment {
          SM_API_KEY = credentials('SM_API_KEY')
          SM_HOST = credentials('SM_HOST')
          SM_CLIENT_CERT_PASSWORD = credentials('SM_CLIENT_CERT_PASSWORD')
          SM_CLIENT_CERT_FILE = credentials('SM_CLIENT_CERT_FILE')
        }
        stages {
          stage('Set up Software Trust Manager') {
            steps {
              SoftwareTrustManagerSetup()
            }
          }
      

      I also tried moving this stage to later in the build, but get the same exception.

       

          [JENKINS-73368] Calling SoftwareTrustManagerSetup() causes java.lang.IllegalStateException: Jenkins.instance is missing

          Chris added a comment -

          I have this same issue, Linux or Windows agent does not matter.

          Jenkins 2.452.1
          Plugin 13.v147276d96cb_1

          Chris added a comment - I have this same issue, Linux or Windows agent does not matter. Jenkins 2.452.1 Plugin 13.v147276d96cb_1

          Steven Green added a comment -

          As a workaround, on Windows I use:

          steps {
                  bat "smctl windows certsync --keypair-alias=%SM_KEYPAIR_ALIAS%"
                } 

          Steven Green added a comment - As a workaround, on Windows I use: steps {         bat "smctl windows certsync --keypair-alias=%SM_KEYPAIR_ALIAS%"       }

          vinay added a comment -

          vinay added a comment - The Jenkins plugin has been released. https://plugins.jenkins.io/digicert-software-trust-code-sign/releases/

            vmummadi vinay
            greenius Steven Green
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: