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

Credentials must be referred to by ID which is Jenkins master specific

      The helptext is at odds with what gets generated by the Snippet Generator (see screenshot).

      node {
        sshagent (credentials: ['deploy-dev']) {
          sh 'ssh -o StrictHostKeyChecking=no -l cloudbees 192.168.1.106 uname -a'
        }
      }
      

      Multiple credentials could be passed in the array but it is not supported using Snippet Generator.

      This would be useful, since I have a staging and a production Jenkins master and I would like to refer to the credential by name instead of ID so I can use it between hosts. The snippet generated is with the ID, and only that will work it seems:

      sshagent(['05917262-0ebf-4491-bc84-5029e36ad0e8']) {
          // some block
      }
      

      If I attempt to use the credentials: ['foo'] syntax, my job will fail:

      FATAL: [ssh-agent] Could not find specified credentials
      [ssh-agent] Looking for ssh-agent implementation...
      [ssh-agent]   Java/JNR ssh-agent
      [ssh-agent] Started.
      

          [JENKINS-32101] Credentials must be referred to by ID which is Jenkins master specific

            Unassigned Unassigned
            rtyler R. Tyler Croy
            Votes:
            1 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: