writeSSHKey

writeSSHKey $secretName $privateName

Write SSH credentials correctly based on a fixed secret format.

secrets.json example:

  "default-ssh": {
    "kind": "Secret",
    "data": {
      "privateKey":
         "-----BEGIN OPENSSH PRIVATE KEY-----\n.....\n-----END OPENSSH PRIVATE KEY-----\n",
      "publicKey":
         "ssh-rsa ..... default-ssh@hercules-ci\n"
    }
  }

Parameters

$secretName

Optional. Default: ssh

The name of the secret to read. Must match the attribute name of a secretsMap entry.

$privateName

Optional. Default: ~/.ssh/id_rsa

Where to write the private key. A public key will be derived and written to ${privateName}.pub