Multiple drone instances with Github Commit Status

Right now if you have multiple drone systems, like v0.8 and v1, the github status reporting on the same name and therefore overwriting each other.

There is a context field, which can make so you have multiple build status that have the same name:

In the latest snapshot of rc.5 you can customize the status label with the DRONE_STATUS_LABEL environment variable. The variable accepts a Go template string like this:

DRONE_STATUS_LABEL={{if eq .Build.Event "pull_request"}}drone/pull-request{{ else }}drone/push{{end}}

Disclaimer that we will probably change the environment variable and syntax before 1.0 final is release, so you can use this, but you should expect a breaking syntax change in the future.

Thanks for that swift responsive, where can I read more about that? :slight_smile:

sorry, nowhere yet, just added it a few days ago and have not had time to document.

Will test the solution out! :+1:

I guess it has to look like this if it has to cover all events?

"{{if eq .Build.Event \"pull_request\"}}drone-v1/pull-request{{else if eq .Build.Event \"tag\"}}drone-v1/tag{{else if eq .Build.Event \"deployment\"}}drone-v1/deployment{{ else }}drone-v1/push{{end}}"

Hi,

Similar question, but for a single drone instance - if the instance builds the same commit twice because it is part of two branches in active development, their Github status checks will overwrite each other too.

My guess is that I could use customisation of DRONE_STATUS_LABEL to solve my problem as well.

Is there any documentation on it, now that drone’s hit 1.0?

You can use the following configuration parameter:
https://docs.drone.io/server/reference/drone-status-name/

This changes the prefix used when creating the status. You can configure each of your Drone installations to use a different status prefix.

Thanks! Can the branch name be specified as part of the status label?

Thanks! Can the branch name be specified as part of the status label?

This was answered in our chatroom, however, I wanted to include my answer in this thread for future readers. It is not possible to include the branch as part of the status label out of the box, however, there is a workaround.

The recommended approach would be to disable statuses in Drone using the following configuration parameter: https://docs.drone.io/server/reference/drone-status-disabled/

Then create your own service to receive a system webhooks from Drone. This service would be responsible for reading the webhook, and creating the status. You can learn more about webhooks here: How to use Global Webhooks

I also want to point out that we provide a starter project to help you create your own custom webhook receiver: https://github.com/drone/boilr-webhook

1 Like