This tutorial will walk you through adding an SSH Key to your GitLab account and cloning a GitLab private repository in a Refactr pipeline.
This tutorial assumes you already have:
Generate a suitable SSH key pair.
The best method for generating a key pair will vary depending on your operating system. See here for more information:
Log in to GitLab, click on the Account Menu at the top right, and then choose Settings.
Copy and paste the public key generated previously into GitLab:
In your Refactr project, click on the Credentials on left navigation. Click New Credential, and proceed to create a new credential of the type Built-in: SSH Private Key.
Copy and paste the private key generated previously into the SSH Private Key field.
Next, navigate to your pipeline, and Open in Builder. Choose the Variables button at the top right and click the Add Variable button. Ensure Variable Type is Credential and Allowed Credential Type to Built-in: SSH Private Key. You can optionally select the new credential you created in the previous step as the value for this variable.
Back in GitLab, navigate to the repository you wish to clone, and copy the SSH URL.
Switch back the the Variables tab in your Refactr Pipeline, and add the additional variables as shown in the image below. Paste the SSH Url just copied from GitLab into the value for the Repository Url. Be sure to click Save when you are done!
Now lets add a Git Step Module into your pipeline by dragging it into the builder from the list of step modules on the left pane. Click on the new step in the builder and the step properties form will appear on the right. Update the fields as shown in the image below. Be sure to toggle each of them to Evaluation Mode first because we are using variables for values! When you are finished, click Save at the top of the step form.
Next, click Save at the top left of the builder, and a Save Pipeline dialog will appear. Enter some revision notes, and then click Save and Exit.
Lastly, click Run at the top left of the pipeline and the Run dialog will appear. Update any variable values as needed, and then click the Run button at the bottom.
After clicking Run, you are brought to the current run in progress. Here you can see the console output of the selected run. If the run was successful, you should see a green check mark on the Git step on the left side, and some positive console output as shown in the image below.