Dependencies during release?

Is there a way to have dependencies be enabled (ex: ex_aws) during releases?

here’s my defp deps

[
    {:ex_aws, "~> 2.1", only: :dev, runtime: false},
    {:ex_aws_s3, "~> 2.0", only: :dev, runtime: false},
    {:configparser_ex, "~> 4.0", only: :dev, runtime: false}
]

Attempting to put ExAws commands in a release pipeline results in:

** (UndefinedFunctionError) function ExAws.S3.Upload.stream_file/1 is undefined (module ExAws.S3.Upload is not available)

Thanks in advance!

Remove the runtime: false option. Also remove only: dev since releases are usually assembled using MIX_ENV=prod.

2 Likes

runtime: false explicitly tells mix to not include this library in a release, so you probably want to remove that setting.

1 Like

I don’t want them in the release. I want them while I’m assembling the release, strictly at compile-time. (Take the release artifact tat.gz and put it up onto s3.). The app doesn’t use Amazon and shouldn’t ever touch Amazon services.

I forgot that I’m using a special env for some of my releases, thanks!

Oh…

So how do you use those libraries?

Can you perhaps give a stripped down example repository which shows your deployment workflow?

Anyway, I think it will be much easier to just do the upload in a separate bash script (or one that wraps building the release).

Agree to disagree? AFAICT there are only relatively hackish ways to extract the tar.gz file path out of the release workflow and into a wrapping script (e.g. saving to a static temporary text file asset). If you use the release pipeline then it’s easy to figure out the path programatically.