I’ve been trying to hook Drone up to a private Python repository so as to use it as a default for all ‘pip’ installs. According to the ‘pip’ docs, ‘pip’ will respect a PIP_INDEX_URL environment variable if set. So I’m tying to figure out how to set that variable for all builds.
The first way I found was using the DRONE_RUNNER_ENVIRON environment variable. Unfortunately, there’s a known issue (bug?) with the configuration library Drone uses. Putting a URL in the variable results in an error:
error="envconfig.Process: assigning RUNNER_DRONE_RUNNER_ENVIRON to Environ: converting ‘PIP_INDEX_URL:https://piprepo/’ to type map[string]string. details: invalid map item: “PIP_INDEX_URL:https://piprepo/”
As of Drone 1.0 the variable name is DRONE_RUNNER_ENVIRON
The workaround mentioned in that thread is using custom json decoder for the map. This would be a breaking change for our users and is therefore something we would prefer to avoid. With that being said, perhaps we could introduce DRONE_RUNNER_ENVIRON_FILE as a new variable that loads a set of environment variables from file? We could use https://github.com/joho/godotenv (existing dependency) which would not be subject to the same limitation as the envconfig library.
An environment file would be perfect. I would generally prefer that to DRONE_RUNNER_ENVIRON anyway. Putting multiple key/value pairs in a string is a little unwieldy once you get past 3 or so.