Drone-cli: cannot supply commit ref to exec

Hello,

Attempting to run my pipeline using drone-cli ‘drone exec’, I’ve noticed I cannot pass the commit ref either by setting env variable DRONE_COMMIT_REF on shell and the cli argument --ref has been disabled (drone-cli/drone/exec/exec.go at master · harness/drone-cli · GitHub).

Here is a sample pipeline:

kind: pipeline
name: default

steps:
- name: test
  image: alpine
  commands:
  - set

drone cli version 1.6.2 (windows)

neither the following works:
attempting to set variable in powershell:

$env:DRONE_COMMIT_REF='refs/tags/1.2.3'

attempting to set environment inside .drone.yml:

environment:
  DRONE_COMMIT_REF: 'refs/tags/1.2.3'

According to documentation Command Line Runner | Drone , it should be possible to emulate metadata like DRONE_SYSTEM_HOST=drone.company.com drone exec but I cannot replicate it.

How to supply metadata to drone exec ?

1 Like

I’m also running into the same issue, whichever is the metadata from References list.

Any solutions?

Although it is not a generic solution, I’ve managed to get around my needs with using PLUGIN_ENV_FILE.