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

Parameter expression may only resolve to a credentials ID

      When using the Parameter Expression option, it's unclear what the expression needs to resolve to. After some guessing, I figured out it likes credentials IDs. First, the fact that I had to figure this out by trial and error is annoying (it's undocumented AFAICT).

      Second, it would be nice if you could search by name/description. Otherwise, for this parameter to be used, I have to maintain a table of name to ID mappings somewhere in the job's parameters, and that's fragile and redundant.

          [JENKINS-31946] Parameter expression may only resolve to a credentials ID

          Jesse Glick added a comment -

          Inline help probably needs to be created.

          I am not following why you think you need to search by name. Specify custom, meaningful IDs when creating the credentials.

          Jesse Glick added a comment - Inline help probably needs to be created. I am not following why you think you need to search by name. Specify custom, meaningful IDs when creating the credentials.

          Nick Irvine added a comment -

          To clarify, the property names I'm using come from the Credentials > <domain> page:

          • ID: part of the URL when I click on a cred: http://<tld>/credential-store/domain/<domain>/<id>/, e.g., e297bca6-4aa0-4fae-a625-2a6b996373d4
          • name: for username/password type, it is autogenerated: "<username>/***** (<description>)"

          Maybe there is a way to use the name that I'm not aware of.

          Nick Irvine added a comment - To clarify, the property names I'm using come from the Credentials > <domain> page: ID: part of the URL when I click on a cred: http://<tld>/credential-store/domain/<domain>/<id>/, e.g., e297bca6-4aa0-4fae-a625-2a6b996373d4 name: for username/password type, it is autogenerated: "<username>/***** (<description>)" Maybe there is a way to use the name that I'm not aware of.

          Nick Irvine added a comment - - edited

          Some more testing reveals that it looks like Parameter Expression doesn't actually expand parameters? Just keep getting the following:

          FATAL: ${CREDS_ID}
          16:14:03 org.jenkinsci.plugins.credentialsbinding.impl.CredentialNotFoundException: ${CREDS_ID}
          

          I'm definitely setting CREDS_ID; it works with an Environment Script that executes earlier.

          Nick Irvine added a comment - - edited Some more testing reveals that it looks like Parameter Expression doesn't actually expand parameters? Just keep getting the following: FATAL: ${CREDS_ID} 16:14:03 org.jenkinsci.plugins.credentialsbinding.impl.CredentialNotFoundException: ${CREDS_ID} I'm definitely setting CREDS_ID; it works with an Environment Script that executes earlier.

          Jesse Glick added a comment -

          When creating new credentials, use the Advanced section to specify a mnemonic ID.

          Jesse Glick added a comment - When creating new credentials, use the Advanced section to specify a mnemonic ID.

          Nick Irvine added a comment -

          Sigh. If I can only query by ID, why hide it in advanced? Why have a name and a description field if you can only reference ID? Is the ID namespace global or per domain? If global, what's the point of a domain? /rant

          So my real problem comes down to the error message. After some testing, I found that it is the same (like above) in both the case where CREDS_ID is undefined and when it is defined but invalid. In the invalid case, it doesn't tell me what CREDS_ID is, which lead me to believe it wasn't being subbed correctly.

          Nick Irvine added a comment - Sigh. If I can only query by ID, why hide it in advanced? Why have a name and a description field if you can only reference ID? Is the ID namespace global or per domain? If global, what's the point of a domain? /rant So my real problem comes down to the error message. After some testing, I found that it is the same (like above) in both the case where CREDS_ID is undefined and when it is defined but invalid. In the invalid case, it doesn't tell me what CREDS_ID is, which lead me to believe it wasn't being subbed correctly.

          Jesse Glick added a comment -

          Ought to be shown without an Advanced block. Domains restrict applicability for example in the UI but IDs must still be globally unique.

          Jesse Glick added a comment - Ought to be shown without an Advanced block. Domains restrict applicability for example in the UI but IDs must still be globally unique.

          I have been looking for the same thing, and what I found is that the reason for closing JENKINS-36470 makes this one closable also.
          Or maybe that is just too much security reasons?

          Marek Włodarczyk added a comment - I have been looking for the same thing, and what I found is that the reason for closing JENKINS-36470 makes this one closable also. Or maybe that is just too much security reasons?

          Jesse Glick added a comment -

          Jesse Glick added a comment - As of https://github.com/jenkinsci/credentials-plugin/commit/e2bf9d867926d1c3b1247122901cf2287ef7416b  the ID is displayed without an Advanced block.

          Jesse Glick added a comment -

          JENKINS-45378 tracks improvements to diagnostic message. Perhaps this is a duplicate.

          Jesse Glick added a comment - JENKINS-45378  tracks improvements to diagnostic message. Perhaps this is a duplicate.

            Unassigned Unassigned
            nirvine_bnsv Nick Irvine
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: