SSH keys
SSH keys are one of the most secure and convenient authentication methods. A common use case can be cloning a repository locally or connecting with a remote server. In Buddy’s pipelines, you can use the keys for the following things:
- Authenticate file upload in the SFTP action
- Authenticate script execution on the server in the SSH action
- Authenticate the download of private modules and dependencies in build actions
You can add the key individually to each of your actions, but a more straightforward method is to add it as an environment variable that can be used in the input fields across the whole workspace.
Defining SSH keys
To use a key in one of the actions, you need to add them to environment variables by entering the ${KEY_NAME}
and value. You can define keys for the whole workspace, a project, or a single pipeline:
- Workspace: go to the workspace Preferences and switch to the Environment Variables tab.
- Project: go to Project Options and choose the Environment Variables tab.
- Pipeline: go the pipeline that you want to use the key in and head to the Environment Variables tab.
Adding SSH key as workspace environment variable
Using SSH keys
- To use the key in an SFTP or SSH action, just provide the key value in the key input:
Using SSH key as an environment variable in SFTP action
In build actions all defined keys are available in the
~/.ssh
directory.- If you want Buddy to use your key in SSH connections by default, name it
id_rsa
If your build requires more than one key, add
~/.ssh/config
to the pipeline’s filesystem and define which key is used for what host, eg.:Host github.com IdentityFile ~/.ssh/github.key
Location of pipeline filesystem
- If you want Buddy to use your key in SSH connections by default, name it
Last modified on April 26, 2022