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

Cannot configure SSH credentials via Job DSL

XMLWordPrintable

    • job-dsl-plugin 1.79

      Version 1.16 of the SSH Credentials plugin changed the plain SSH private key from String to a hudson.util.Secret.

      This leads to the situation that Job DSL cannot be used to configure SSH credentials any longer.

      This snippet works when using SSH Credentials plugin 1.15:

      folder('foo') {
        properties {
          folderCredentialsProperty {
            domainCredentials {
              domainCredentials {
                domain {
                  name(null)
                  description(null)
                }
                credentials {
                  basicSSHUserPrivateKey {
                    scope('GLOBAL')
                    id('my-ssh')
                    description('My SSH Credentials')
                    username('me')
                    passphrase('')
                    privateKeySource {
                      directEntryPrivateKeySource {
                        privateKey('SSH-PRIVATE-KEY-HERE')
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
      

      But with SSH Credentials version 1.16, the privateKeySource directive shows as empty in the Job DSL's API browser.

      Maybe there's a way to also support hudson.util.Secret in Job DSL (by simply wrapping Strings into Secret.fromString(...))?

            Unassigned Unassigned
            twz123 Tom Wieczorek
            Votes:
            8 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:
              Resolved: