So you want to upgrade Distillery

...but don't want to change your current build pipeline? This was a challenge I faced as part of our effort to overhaul how we build and deploy our Elixir app.

We are in the process of moving from a Docker container to an Erlang release as our basic unit for deployment. We also want to revisit how we inject configuration and secrets into our application at runtime. Because Distillery 2.0 has features to make both of those goals easier, upgrading Distillery was the first step.

We still need to ship new features and bug fixes throughout the upgrade, so the existing pipeline needs to remain intact. Our solution to parallel build paths came to me when I (re)remembered that the mix.exs file is just code, and can therefore have logic. At that point it became a matter of introducing an environment variable into our CI script, and turning this:

into this: