How do I set up Jenkins to deploy to Enclave?
To deploy from Jenkins on Aptible, we recommend the following approach. We assume that you have already installed and set up the Jenkins Git Plugin on your Jenkins server.
- Create a “Robots” role in your Aptible organization and grant it “Read” and “Manage” permissions on your production account.
- Invite a new deploy user to this Robots role. It needs to have a real email address, but can be something like email@example.com.
- Log out of your Aptible account.
- Generate an SSH key pair for the deploy user (you can do this via:
ssh-keygen -f deploy.pem). Don’t set a password for the key, since that won’t work well on Travis.
- Accept the invitation for firstname.lastname@example.org, activate the account, and upload the public key from Step 4 on your Aptible User Settings page.
In Jenkins, add your source repository URL, as described in this blog post. Then, add a second repository, with the git remote URL
email@example.com:<environment>/<app>.git. Upload the private key from Step 4 using the “Add Key” icon, and set the remote name to “aptible” under “Advanced…”
Note: You can confirm the correct Git remote URL at the top of your app’s page in the Aptible Dashboard.
Add a post-build “Git Publisher” trigger, to deploy to the “master” branch of the new “aptible” remote.