DRONE_AGENT_ENV_FILE does not set environment variables for steps

I am attempting to accomplish this: Setting global agent environment URL variables

I have set the DRONE_AGENT_ENV_FILE properly because when I do a docker inspect on the agent container, I see that my environment variables are set.

However, when I trigger a job and docker inspect the container running an individual step, I notice that the custom environment variables that are set in the agent container are not set in the step’s container.

This is problematic as the individual step needs to have PIP_INDEX_URL set, otherwise pip cannot find my private packages.

I am running Drone 1.6, using a docker pipeline. Based on https://docs.drone.io/runner/docker/configuration/reference/ it seems like this isn’t possible?

this feature is only available when you are using the exec, ssh or digitalocean runner. It is not available to the docker runner at this time, but we expect it will be in the future.

I don’t see a repo for autoscaler docs, where do I go to do a PR to let users know that this doesn’t work for the docker runner?

sorry, it was unclear this was in reference to the autoscaler. The autoscaler and runners both have a parameter call DRONE_AGENT_ENV_FILE, but they are unrelated. When passed to the autoscaler, this field sets agent environment variables. These variables do not propagate to the pipeline steps.

I’m a little confused, I only see one reference to DRONE_AGENT_ENV_FILE and it’s from the autoscaler at https://autoscale.drone.io/reference/drone-agent-env-file/.

Are you saying there is an undocumented DRONE_AGENT_ENV_FILE which you set on a runner? I do see a DRONE_RUNNER_ENVIRON.

As for the future, do you see the functionality to be propagating the variables in DRONE_AGENT_ENV_FILE to docker runners or is there something else you had in mind?

Sorry, the confusion here is because my initial answer assumed we were talking about runner (agent) configuration parameters, not autoscaler configuration parameters.

The autoscaler has a parameter named DRONE_AGENT_ENV_FILE which is used to source environment variables from a file. The variables are used to configure the runner (agent). They are not exposed to pipeline steps. Pipeline steps do not inherit runner environment variables because they contain sensitive information (rpc secrets, global secrets, global registry credentials, etc)

The exec runner also has a documented parameter of the same name (this is the source of confusion). This parameter is used to load variables from file and pass to pipeline steps. https://docs.drone.io/runner/exec/configuration/reference/drone-runner-envfile/

The docker runner (agent) does not have this configuration parameter.

Hopefully this helps clarify.

sort of.

given the complexity of the autoscaler configuration, I no longer believe environment variables are the best way to configure the autoscaler. All of the names and naming conflicts have gotten very confusing. In version 2.0 of the autoscaler I plan to switch to a configuration file (toml, yaml, hcl, etc) which should make configuration more expressive and easier to understand.

I still plan to support configuration from environment variables, but only for a subset of commonly used configuration parameters. Anything more advanced would need to use a configuration file.