Drone

[Feature Request] DRONE_PROJECT_DIR env variable

I think this can be useful to if we need to know the project path in environment: section. For example.

build-dev:
  image: ubuntu
  environment:
    - CCACHE_DIR="${DRONE_ORJECT_DIR}/.ccache"

Or please let me know if there is another way to achieve this!

If you are using Drone 1.x the project path is always going to be /drone/src unless you explicitly change it. The path is exposed to your pipeline steps via the DRONE_WORKSPACE environment variable. Here is a working example:

kind: pipeline
name: default

steps:
- name: test
  image: alpine:3.8
  commands:
  - echo $DRONE_WORKSPACE
$ drone exec
[test:0] + echo $DRONE_WORKSPACE
[test:1] /drone/src

Please note that this only applies to Drone 1.0.0 or higher. Your example configuration looks like it is using the 0.8 syntax which may indicate you are running an older version of Drone.

Thanks! I didn’t know $DRONE_WORKSPACE. Maybe it’s good to update the documentation also? https://docs.drone.io/reference/environ/