Get current workspace from pipeline step env?

Is it possible to get the current workspace dir like /drone/src from a pipeline step via environment variable?

I already looked into the Workspace and Environment Ref docs but couldn’t find anything…

Hello there,

Kindly share with us the use case for which you want to use the workspace path environment variable?

I’m working on some drone plugins which rely on data created on previously ran steps.
So to share the data it has to be within the workspace (cloned) directory. I know the workspace is drone/src. But to make the logic more gerenic it would be awesome to have a environemt var which contains the worspace dir for the current pipeline or step. So it would be easy to parse a nested sub dir.

all plugins are run with the current working directory set to the workspace directory, and therefore have access to files and folders in the workspace at their relative paths. If you look at most of our official plugins, they use relative paths and therefore never need to know the workspace directory. However, if you need to know the workspace directory, you can get this with $(pwd)

Unfortunately I had some issues with relativ paths in my plugin. But I think this realtes to my awesome bash scripting skills ^^. So I tried to resolve the paths and searched of valid sources. I’ll try to work with pwd for now.

Just because DRONE_WORKSPACE was available before exactly for that purpose and some of my pipelines rely on it… since which version it was removed from drone?

drone exec version 1.2.4 and at least my deployed drone runtime (still trying to figure out, where to get this info from) is still is providing this env var to pipelines. If that is gonna be or was already removed, it would be great, if the cli drone exec gets at least another env variable like DRONE=true to differentiate command executions in- and outside of pipelines.