By default, Environment Variables (Env Vars) have a 20KB per-environment value size limit, and a 120KB total size limit. Hence you getting the following error when you try to add a value larger than 20KB:
$ ruby -e 'puts "a"*40_000' | bitrise envman add --key TEST2
WARN[07:37:46] environment value too large
WARN[07:37:46] environment value size (39.0634765625 KB) - max allowed size: 20 KB
FATA[07:37:46] [ENVMAN] environment value too large - rejected
FATA[07:37:46] Command failed, error: exit status 1
As you can see, this is a built-in limitation in our envman
tool. The limitation exists because many tools, including bash, cannot work well with large variables. Therefore we recommend finding alternative solutions for storing large amounts of data instead of storing it as an Env Var.
However, if you absolutely must, you can increase the size limit by modifying the envman
tool’s config file.
To set the size limit in your build’s virtual machines on Bitrise:
- On bitrise.io, open your app.
- Click on the Workflow tab to open the Workflow Editor.
- Add a Script Step to the Workflow(s) you want to run.
-
Add the following command to the Step’s
contents
:#!/usr/bin/env bash set -ex mkdir -p ~/.envman && echo -e '{"env_bytes_limit_in_kb": 40}' > ~/.envman/configs.json
In this example, we increased the file size limit to 40KB but you can set any value you want - just be aware that certain tools might not be able to handle large Env Vars!