CI Integration

At a high level, integrating Enclave with your CI platform boils down to the following steps:

Creating a Robot User

  1. Create a “Robots” Role in your Aptible Organization, and grant it “Read” and “Manage” Permissions on the Environment you’d like to automate deployment to.
  2. Invite a new user to this Robots role. It needs to have a real email address. Most customers use something like deploy@yourdomain.com.
  3. Log out of your Aptible account, accept the invitation you received for the robot user by email, and create a password for the robot user.

If you’re going to use this user to deploy an App using Dockerfile Deploy, you’re also going to need a SSH keypair for the deploy user to let them connect to your App’s Git Remote:

  1. Generate a SSH key pair for the deploy user using ssh-keygen -f deploy.pem. Don’t set a password for the key.
  2. Register the SSH Public Key with Enclave for the robot user.

Triggering a Deploy

Dockerfile Deploy

Most CI platforms expose some form of “after-success” hook you can use to trigger a deploy to Enclave after your tests have passed. You’ll need to use it to trigger a deploy to Enclave by running git push.

For the git push to work, you’ll also need to provide your CI platform with the SSH key you created for your robot user. To that end, most CI platforms let you provide encrypted files to store in your repository.

We provide per-platform instructions here:

Direct Docker Image Deploy

To deploy with Direct Docker Image Deploy, you’ll need to build and publish a Docker Image when your build succeeds. Then, you can install the Aptible CLI in your CI environment, log in as the robot user, and use aptible deploy to trigger a deploy to Enclave.