DRONE_FAILED_STEPS is always empty

Drone environment reference claims there is a DRONE_FAILED_STEPS variable that will provide a list of failed pipeline steps. However, this variable is always empty in my pipelines no matter how many failing steps I have prior to printing it.

I understand that this variable will be empty at YAML parse time, but it should not be empty at runtime if there are failed steps (I am printing it from a bash plugin; all other Drone variables work there).

When I checked the source code, I was not able to find this variable there. (The same goes for another similar one, DRONE_FAILED_STAGES.) Does it actually exist? If not, please reintroduce it - it’s crucial to know which exact pipeline steps have failed to implement notifications when there are parallel steps.

I haven’t looked at the provided variables in the source code, but just for my reference, are you using ${DRONE_FAILED_STEPS} or $${DRONE_FAILED_STEPS} in your pipelines? (It needs to be the latter for commands directly in the YAML file)

Although this is indeed an important point about variable substitution/escaping gotchas in YAML, unfortunately, it does not apply here.

I am printing it from a bash plugin; all other Drone variables work there

I have found a comment in another thread that points out that environment variables do not get updated when using a Kubernetes runner and Drone works around that by writing them to and reading them from a file. I am using a Kubernetes runner (should have specified in my original post, but keep forgetting that Drone still has all sorts of weird undocumented hiccups with Kubernetes).

Is this what is happening here? If so, how can I access this file? (The link in the comment is sadly dead) Also, this still does not explain whether the variable actually exists, since I couldn’t find it in the source code.

After some poking around, I’ve found that Drone Kubernetes runner uses Kubernetes Downward API. It stores environment variables in /run/drone/env. There, I was able to find DRONE_BUILD_STATUS which was accurately updated to failure to reflect the overall pipeline failing. However, DRONE_FAILED_STEPS was not there. So where is it?