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

Parameter Expression throws CredentialNotFoundException

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • None

      When configuring a job with credentials binding the 'specific credentials' do work but when I try to use the 'parameter expression' it always fails with the following message:

      [EnvInject] - Loading node environment variables.
      [EnvInject] - Preparing an environment for the build.
      [EnvInject] - Keeping Jenkins system variables.
      [EnvInject] - Keeping Jenkins build variables.
      [EnvInject] - Evaluation the following Groovy script content: 
      println "secret_file_id:" + secret_file_id
      
      secret_file_id:keystore
      [EnvInject] - Injecting contributions.
      Building on master in workspace /var/lib/jenkins/workspace/Credential-binding-parameter-expression
      FATAL: ${secret_file_id}
      org.jenkinsci.plugins.credentialsbinding.impl.CredentialNotFoundException: ${secret_file_id}
      	at org.jenkinsci.plugins.credentialsbinding.MultiBinding.getCredentials(MultiBinding.java:124)
      	at org.jenkinsci.plugins.credentialsbinding.impl.FileBinding.bindSingle(FileBinding.java:52)
      	at org.jenkinsci.plugins.credentialsbinding.Binding.bind(Binding.java:133)
      	at org.jenkinsci.plugins.credentialsbinding.impl.SecretBuildWrapper.setUp(SecretBuildWrapper.java:58)
      	at hudson.model.Build$BuildExecution.doRun(Build.java:156)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
      	at hudson.model.Run.execute(Run.java:1738)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      	at hudson.model.ResourceController.execute(ResourceController.java:98)
      	at hudson.model.Executor.run(Executor.java:410)
      Finished: FAILURE
      

      As shown in config-attachment the referenced secret file (ID: 'keystore') is found when using the specific credentials option. When I try to load it dynamically with the parameter expression using ${secret_file_id} the exception is thrown.

      I've spend a fair amount of time testing with different settings for credentials and plugin versions but none fixed my issue. I've attached an example job configuration that mimics my issue.

      Basically the one I'm trying to achieve is a job that based upon a parameter builds and signs an Android app. The parameter is either supplied through a properties file inside a git repo or by making the build 'parameterized'. Any help would be appreciated!

      Cheers, Erik

        1. config.png
          config.png
          59 kB
        2. environment-variables.png
          environment-variables.png
          290 kB
        3. bot-config.xml
          2 kB

          [JENKINS-36470] Parameter Expression throws CredentialNotFoundException

          Erik The Other Wizzard created issue -
          Erik The Other Wizzard made changes -
          Description New: When configuring a job with credentials binding the 'specific credentials' do work but when I try to use the 'parameter expression' it always fails with the following message:

          ```
          [EnvInject] - Loading node environment variables.
          [EnvInject] - Preparing an environment for the build.
          [EnvInject] - Keeping Jenkins system variables.
          [EnvInject] - Keeping Jenkins build variables.
          [EnvInject] - Evaluation the following Groovy script content:
          println "secret_file_id:" + secret_file_id

          secret_file_id:keystore
          [EnvInject] - Injecting contributions.
          Building on master in workspace /var/lib/jenkins/workspace/Credential-binding-parameter-expression
          FATAL: ${secret_file_id}
          org.jenkinsci.plugins.credentialsbinding.impl.CredentialNotFoundException: ${secret_file_id}
          at org.jenkinsci.plugins.credentialsbinding.MultiBinding.getCredentials(MultiBinding.java:124)
          at org.jenkinsci.plugins.credentialsbinding.impl.FileBinding.bindSingle(FileBinding.java:52)
          at org.jenkinsci.plugins.credentialsbinding.Binding.bind(Binding.java:133)
          at org.jenkinsci.plugins.credentialsbinding.impl.SecretBuildWrapper.setUp(SecretBuildWrapper.java:58)
          at hudson.model.Build$BuildExecution.doRun(Build.java:156)
          at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
          at hudson.model.Run.execute(Run.java:1738)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          at hudson.model.ResourceController.execute(ResourceController.java:98)
          at hudson.model.Executor.run(Executor.java:410)
          Finished: FAILURE
          ```
          Environment New: Jenkins ver. 1.648

          os.arch amd64
          os.name Linux
          os.version 4.2.0-38-generic
          java.runtime.name OpenJDK Runtime Environment
          java.runtime.version 1.7.0_101-b00
          java.vm.name OpenJDK 64-Bit Server VM

          Plugins:
          plain-credentials 1.2 true false
          credentials 2.1.4 true false
          credentials-binding 1.8 true false
          Summary Original: Parameter Expression always throws CredentialNotFoundException New: Parameter Expression throws CredentialNotFoundException
          Erik The Other Wizzard made changes -
          Description Original: When configuring a job with credentials binding the 'specific credentials' do work but when I try to use the 'parameter expression' it always fails with the following message:

          ```
          [EnvInject] - Loading node environment variables.
          [EnvInject] - Preparing an environment for the build.
          [EnvInject] - Keeping Jenkins system variables.
          [EnvInject] - Keeping Jenkins build variables.
          [EnvInject] - Evaluation the following Groovy script content:
          println "secret_file_id:" + secret_file_id

          secret_file_id:keystore
          [EnvInject] - Injecting contributions.
          Building on master in workspace /var/lib/jenkins/workspace/Credential-binding-parameter-expression
          FATAL: ${secret_file_id}
          org.jenkinsci.plugins.credentialsbinding.impl.CredentialNotFoundException: ${secret_file_id}
          at org.jenkinsci.plugins.credentialsbinding.MultiBinding.getCredentials(MultiBinding.java:124)
          at org.jenkinsci.plugins.credentialsbinding.impl.FileBinding.bindSingle(FileBinding.java:52)
          at org.jenkinsci.plugins.credentialsbinding.Binding.bind(Binding.java:133)
          at org.jenkinsci.plugins.credentialsbinding.impl.SecretBuildWrapper.setUp(SecretBuildWrapper.java:58)
          at hudson.model.Build$BuildExecution.doRun(Build.java:156)
          at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
          at hudson.model.Run.execute(Run.java:1738)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          at hudson.model.ResourceController.execute(ResourceController.java:98)
          at hudson.model.Executor.run(Executor.java:410)
          Finished: FAILURE
          ```
          New: When configuring a job with credentials binding the 'specific credentials' do work but when I try to use the 'parameter expression' it always fails with the following message:

          {code}
          [EnvInject] - Loading node environment variables.
          [EnvInject] - Preparing an environment for the build.
          [EnvInject] - Keeping Jenkins system variables.
          [EnvInject] - Keeping Jenkins build variables.
          [EnvInject] - Evaluation the following Groovy script content:
          println "secret_file_id:" + secret_file_id

          secret_file_id:keystore
          [EnvInject] - Injecting contributions.
          Building on master in workspace /var/lib/jenkins/workspace/Credential-binding-parameter-expression
          FATAL: ${secret_file_id}
          org.jenkinsci.plugins.credentialsbinding.impl.CredentialNotFoundException: ${secret_file_id}
          at org.jenkinsci.plugins.credentialsbinding.MultiBinding.getCredentials(MultiBinding.java:124)
          at org.jenkinsci.plugins.credentialsbinding.impl.FileBinding.bindSingle(FileBinding.java:52)
          at org.jenkinsci.plugins.credentialsbinding.Binding.bind(Binding.java:133)
          at org.jenkinsci.plugins.credentialsbinding.impl.SecretBuildWrapper.setUp(SecretBuildWrapper.java:58)
          at hudson.model.Build$BuildExecution.doRun(Build.java:156)
          at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
          at hudson.model.Run.execute(Run.java:1738)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          at hudson.model.ResourceController.execute(ResourceController.java:98)
          at hudson.model.Executor.run(Executor.java:410)
          Finished: FAILURE
          {code}
          Erik The Other Wizzard made changes -
          Attachment New: bot-config.xml [ 33222 ]
          Attachment New: environment-variables.png [ 33223 ]
          Erik The Other Wizzard made changes -
          Attachment New: config.png [ 33224 ]
          Erik The Other Wizzard made changes -
          Description Original: When configuring a job with credentials binding the 'specific credentials' do work but when I try to use the 'parameter expression' it always fails with the following message:

          {code}
          [EnvInject] - Loading node environment variables.
          [EnvInject] - Preparing an environment for the build.
          [EnvInject] - Keeping Jenkins system variables.
          [EnvInject] - Keeping Jenkins build variables.
          [EnvInject] - Evaluation the following Groovy script content:
          println "secret_file_id:" + secret_file_id

          secret_file_id:keystore
          [EnvInject] - Injecting contributions.
          Building on master in workspace /var/lib/jenkins/workspace/Credential-binding-parameter-expression
          FATAL: ${secret_file_id}
          org.jenkinsci.plugins.credentialsbinding.impl.CredentialNotFoundException: ${secret_file_id}
          at org.jenkinsci.plugins.credentialsbinding.MultiBinding.getCredentials(MultiBinding.java:124)
          at org.jenkinsci.plugins.credentialsbinding.impl.FileBinding.bindSingle(FileBinding.java:52)
          at org.jenkinsci.plugins.credentialsbinding.Binding.bind(Binding.java:133)
          at org.jenkinsci.plugins.credentialsbinding.impl.SecretBuildWrapper.setUp(SecretBuildWrapper.java:58)
          at hudson.model.Build$BuildExecution.doRun(Build.java:156)
          at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
          at hudson.model.Run.execute(Run.java:1738)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          at hudson.model.ResourceController.execute(ResourceController.java:98)
          at hudson.model.Executor.run(Executor.java:410)
          Finished: FAILURE
          {code}
          New: When configuring a job with credentials binding the 'specific credentials' do work but when I try to use the 'parameter expression' it always fails with the following message:

          {code}
          [EnvInject] - Loading node environment variables.
          [EnvInject] - Preparing an environment for the build.
          [EnvInject] - Keeping Jenkins system variables.
          [EnvInject] - Keeping Jenkins build variables.
          [EnvInject] - Evaluation the following Groovy script content:
          println "secret_file_id:" + secret_file_id

          secret_file_id:keystore
          [EnvInject] - Injecting contributions.
          Building on master in workspace /var/lib/jenkins/workspace/Credential-binding-parameter-expression
          FATAL: ${secret_file_id}
          org.jenkinsci.plugins.credentialsbinding.impl.CredentialNotFoundException: ${secret_file_id}
          at org.jenkinsci.plugins.credentialsbinding.MultiBinding.getCredentials(MultiBinding.java:124)
          at org.jenkinsci.plugins.credentialsbinding.impl.FileBinding.bindSingle(FileBinding.java:52)
          at org.jenkinsci.plugins.credentialsbinding.Binding.bind(Binding.java:133)
          at org.jenkinsci.plugins.credentialsbinding.impl.SecretBuildWrapper.setUp(SecretBuildWrapper.java:58)
          at hudson.model.Build$BuildExecution.doRun(Build.java:156)
          at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
          at hudson.model.Run.execute(Run.java:1738)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          at hudson.model.ResourceController.execute(ResourceController.java:98)
          at hudson.model.Executor.run(Executor.java:410)
          Finished: FAILURE
          {code}

          As shown in config-attachment the referenced secret file (ID: 'keystore') is found when using the specific credentials option. When I try to load it dynamically with the parameter expression using ${secret_file_id} the exception is thrown.


          Erik The Other Wizzard made changes -
          Description Original: When configuring a job with credentials binding the 'specific credentials' do work but when I try to use the 'parameter expression' it always fails with the following message:

          {code}
          [EnvInject] - Loading node environment variables.
          [EnvInject] - Preparing an environment for the build.
          [EnvInject] - Keeping Jenkins system variables.
          [EnvInject] - Keeping Jenkins build variables.
          [EnvInject] - Evaluation the following Groovy script content:
          println "secret_file_id:" + secret_file_id

          secret_file_id:keystore
          [EnvInject] - Injecting contributions.
          Building on master in workspace /var/lib/jenkins/workspace/Credential-binding-parameter-expression
          FATAL: ${secret_file_id}
          org.jenkinsci.plugins.credentialsbinding.impl.CredentialNotFoundException: ${secret_file_id}
          at org.jenkinsci.plugins.credentialsbinding.MultiBinding.getCredentials(MultiBinding.java:124)
          at org.jenkinsci.plugins.credentialsbinding.impl.FileBinding.bindSingle(FileBinding.java:52)
          at org.jenkinsci.plugins.credentialsbinding.Binding.bind(Binding.java:133)
          at org.jenkinsci.plugins.credentialsbinding.impl.SecretBuildWrapper.setUp(SecretBuildWrapper.java:58)
          at hudson.model.Build$BuildExecution.doRun(Build.java:156)
          at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
          at hudson.model.Run.execute(Run.java:1738)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          at hudson.model.ResourceController.execute(ResourceController.java:98)
          at hudson.model.Executor.run(Executor.java:410)
          Finished: FAILURE
          {code}

          As shown in config-attachment the referenced secret file (ID: 'keystore') is found when using the specific credentials option. When I try to load it dynamically with the parameter expression using ${secret_file_id} the exception is thrown.


          New: When configuring a job with credentials binding the 'specific credentials' do work but when I try to use the 'parameter expression' it always fails with the following message:

          {code}
          [EnvInject] - Loading node environment variables.
          [EnvInject] - Preparing an environment for the build.
          [EnvInject] - Keeping Jenkins system variables.
          [EnvInject] - Keeping Jenkins build variables.
          [EnvInject] - Evaluation the following Groovy script content:
          println "secret_file_id:" + secret_file_id

          secret_file_id:keystore
          [EnvInject] - Injecting contributions.
          Building on master in workspace /var/lib/jenkins/workspace/Credential-binding-parameter-expression
          FATAL: ${secret_file_id}
          org.jenkinsci.plugins.credentialsbinding.impl.CredentialNotFoundException: ${secret_file_id}
          at org.jenkinsci.plugins.credentialsbinding.MultiBinding.getCredentials(MultiBinding.java:124)
          at org.jenkinsci.plugins.credentialsbinding.impl.FileBinding.bindSingle(FileBinding.java:52)
          at org.jenkinsci.plugins.credentialsbinding.Binding.bind(Binding.java:133)
          at org.jenkinsci.plugins.credentialsbinding.impl.SecretBuildWrapper.setUp(SecretBuildWrapper.java:58)
          at hudson.model.Build$BuildExecution.doRun(Build.java:156)
          at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
          at hudson.model.Run.execute(Run.java:1738)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          at hudson.model.ResourceController.execute(ResourceController.java:98)
          at hudson.model.Executor.run(Executor.java:410)
          Finished: FAILURE
          {code}

          As shown in config-attachment the referenced secret file (ID: 'keystore') is found when using the specific credentials option. When I try to load it dynamically with the parameter expression using ${secret_file_id} the exception is thrown.


          I've spend a fair amount of time testing with different settings for credentials and plugin versions but none fixed my issue. I've attached an example job configuration that mimics my issue.

          Basically the one I'm trying to achieve is a job that based upon a parameter builds and signs an Android app. The parameter is either supplied through a properties file inside a git repo or by making the build 'parameterized'. Any help would be appreciated!

          Cheers, Erik
          Stephen Connolly made changes -
          Resolution New: Not A Defect [ 7 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          Stephen Connolly made changes -
          Assignee Original: Jesse Glick [ jglick ] New: Stephen Connolly [ stephenconnolly ]
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 173179 ] New: JNJira + In-Review [ 199405 ]
          Stephen Connolly made changes -
          Status Original: Resolved [ 5 ] New: Closed [ 6 ]

            stephenconnolly Stephen Connolly
            erik_too Erik The Other Wizzard
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: