In your example you are passing DOC_DIR to the agent. The problem with your example is that builds do not run in the agent, which means they will not inherit agent environment variables. Builds are run in their own docker containers spawned by the agent on the host machine, using the docker socket that you mount into the agent.
But the volumes instructions are interpreted by the agent, right?
should be interpreted, as it is defined in the agent, no ?
Nope, this isn’t quite how things work
The server parses the yaml and interpolates parameters, not the agent
The server interpolates internal variables only. It does not interpolate from the environment. If you want drone to interpolate custom variables it needs to be explicitly configured http://docs.drone.io/configure-global-environment/
Ok, I understand better, thanks for the details.
I tried to configure it, but it did not work. I think it is because of its unavailability on the community edition.
Any plan to put the global environment feature in the open-source version?
I think you can try somthing like “DRONE_RUNNER_ENV_FILE=/proc/1/environ” when you start your agent. This will pass your host’s environment into every step.
If you need to customize Drone in order to pass additional environment variables to your pipeline, the recommended approach is to create an environment extension. See https://docs.drone.io/extensions/environment/