Drone kube runner 1.0 b6 does not signal pipeline failures

The same pipeline running on docker runner will set all envs to failure DRONE_BUILD_STATUS, DRONE_STAGE_STATUS …
on Kubernetes runner: DRONE_BUILD_STATUS=success

kind: pipeline
name: build
type: kubernetes

steps:

  • name: test
    image: alpine:3.8
    commands:

    • exit 2
  • name: failenv
    image: alpine:3.8
    commands:

    • env
      when:
      status: [ success, failure ]
      depends_on:
  • test

I know about the existence of /run/drone/env but could failures be sent ?

This is a documented limitation of the beta Kubernetes runner [1]

Unlike docker pipelines, the pipeline status is passed to steps by file as opposed to environment variable. Existing plugins may not be compatible with kubernetes pipelines and will need to be patched accordingly. See how we patched the Slack plugin.

This is because we create a pod for each pipeline, and each step in the pipeline is a container in that pod. We cannot update container environment variables once the pod is created, which means we cannot update the environment variables to reflect changes in status. The live status is therefore available via the filesystem (updated via the downward api) at /run/drone/env

[1] https://docs.drone.io/runner/kubernetes/overview/#known-issues–differences

Sorry, I had missed this reply.

Failures are sent. The code for updating the build status and the stage status can be found here, and this code is shared by the docker runner and the kubernetes runner. There is no difference in runtime behavior, other than kubernetes writing the updated variables to /run/drone/env (the underlying code can be found here).

I ran a quick test and can see the file is being updated with the expected status. Is it possible your cluster is slow to update the file?

I am using this way to check the status. However sometimes I obtain (I use sed to read the file):

sed: can't read /run/drone/env: No such file or directory

What can cause this?
Usually I restart my K8s deployments and it seems to help…