Continuous Integration
General tips¶
From Distillery's CLI docs:
Quote
If you are building releases as part of your CI/CD pipeline, you may want to use the --warnings-as-errors
flag to the release task. This will prevent building releases which may fail at runtime from making it through the pipeline.
To set this and other options that are passed to mix release
, you can use the config/2
macro:
config/deploy.exs
use Bootleg.DSL
config(:release_args, ["--warnings-as-errors"])
See also: Built-in Macros
CircleCI¶
Running builds from CircleCI¶
Add SSH keys to CircleCI¶
To connect to remote build or app servers using SSH public keys, you must first define those keys in your CircleCI project settings, under "Checkout SSH keys". After adding a key its fingerprint will be displayed.
Example SSH key fingerprint
27:a3:eb:bc:65:b1:99:de:3a:42:3f:9e:75:b6:1b:f9
Using SSH keys in CircleCI containers¶
In order for your container to receive that key, you must specify it in your
.circleci/config.yml
using the CircleCI
add_ssh_keys
step.
CircleCI SSH key configuration
- add_ssh_keys:
fingerprints:
- "27:a3:eb:bc:65:b1:99:de:3a:42:3f:9e:75:b6:1b:f9"
At this point your container will have SSH keys available when launched:
1 2 3 |
|
The private key file is named using the fingerprint above.
Using the CircleCI SSH key within Bootleg¶
To inform Bootleg of your key, you can specify this full filename, or you could symlink or copy it to another name.
Option 1: Specify the full filename in Bootleg
role :build, "example.com", identity: "~/.ssh/id_rsa_27a3ebbc65b199de3a423f9e75b61bf9"
Option 2: Create a symbolic link in CircleCI
Within your CircleCI yml:
steps:
- run: ln -s ~/.ssh/id_rsa_27a3* ~/.ssh/id_foobar_rsa
Within Bootleg config:
role :build, "example.com", identity: "~/.ssh/id_foobar_rsa"
Option 3: Overwrite the default id_rsa
Within your CircleCI yml:
steps:
- run: cp ~/.ssh/id_rsa_* ~/.ssh/id_rsa
Within Bootleg config:
role :build, "example.com", identity: "~/.ssh/id_rsa"