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

Credentials binding fails to find creds when using a Parameterized Expression, but only for timed jobs

      This job attempts to:

      • Take a parameter GAMESPARKS_CREDS_ID as creds
      • Use Credentials Binding to convert the creds into an environment variable GAMESPARKS_CREDS that is the concatenation of username:password for use in a shell script
      • Do so every 2 minutes

      When triggered manually, it works fine. But when triggered by the timer, it fails with the following message:

      FATAL: ${GAMESPARKS_CREDS_ID}
      org.jenkinsci.plugins.credentialsbinding.impl.CredentialNotFoundException: ${GAMESPARKS_CREDS_ID}
      	at org.jenkinsci.plugins.credentialsbinding.MultiBinding.getCredentials(MultiBinding.java:124)
      	at org.jenkinsci.plugins.credentialsbinding.impl.UsernamePasswordBinding.bindSingle(UsernamePasswordBinding.java:50)
      	at org.jenkinsci.plugins.credentialsbinding.Binding.bind(Binding.java:126)
      	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:537)
      	at hudson.model.Run.execute(Run.java:1744)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      	at hudson.model.ResourceController.execute(ResourceController.java:98)
      	at hudson.model.Executor.run(Executor.java:374)
      Finished: FAILURE
      

      If there's a better way to make credentials available in a build script, I'm open to that.

          [JENKINS-32402] Credentials binding fails to find creds when using a Parameterized Expression, but only for timed jobs

          Nick Irvine created issue -
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 168024 ] New: JNJira + In-Review [ 182937 ]
          Jesse Glick made changes -
          Assignee Original: Jesse Glick [ jglick ]
          Jesse Glick made changes -
          Link New: This issue is duplicated by JENKINS-49822 [ JENKINS-49822 ]
          Christopher Sullivan made changes -
          Comment [ I worked around this issue by using the [Authorize Project plugin|https://wiki.jenkins.io/display/JENKINS/Authorize+Project+plugin]. Instead of passing the credentials from the upstream job, I set the {{defaultValue}} of the parameter instead to globally scoped credentials.

          For build "Authorization" (enabled by Authorize Project), I set the job to run as a user with access to the global credentials (I would have used credentials scoped to the user only, but you can't use these as default values). When selecting "Build with Parameters" as any other user, only the user scoped credentials are available.

          Other users can still pass parameters to the job and successfully run it if they have the correct credentials.- If they try to run the job without specifying their own credentials, they can not access the default credentials and the job fails as desired.- (still working on restricting access to the credentials)

          When initiated by timer, it uses the default globally scoped credentials and successfully runs. ]

            Unassigned Unassigned
            nirvine_bnsv Nick Irvine
            Votes:
            24 Vote for this issue
            Watchers:
            29 Start watching this issue

              Created:
              Updated: