Drone

Failed builds returning 200 to github enterprise

drone server 1.7.0

I implemented a DRONE_VALIDATE_PLUGIN_ENDPOINT and it works correctly and if it fails validation the build shows as failed in the drone UI but drone returns a 200 to GHE even on failure.

image

This is the expected behavior. A 2xx response is returned from the server if the webhook delivery is successful. Error codes are reserved for delivery failures or catastrophic failures.

You should make use of proper HTTP status codes in order to inform users. You can use codes like 201 or 202 to acknowledge receipt of payload that won’t be processed (for example, a payload delivered by a branch that’s not the default). Reserve the 500 error code for catastrophic failures.

Ok … but drone is sending this 200 back to GHE. My validation plugin is returning a 404 to Drone when it’s triggered.

So if GHE triggers a drone webhook and the build fails, how does GHE know to reflect the same in the PR?

The webhook response does not have any impact on the pull request status. It sounds like perhaps the problem is not with the webhook response, but instead with the fact that a failed validation plugin does not result in Drone making an API call to set the pull request status?

Ohhh that could be. I don’t actually know how the drone/GHE integration works

I just took a look at the code and can confirm that Drone is not updating the status when the validation plugin fails, even though it should be. So this is something we will have to fix.

1 Like