I maintain a plugin which creates Github deployments and then posts the status of the deploy to an internal slack channel. In Drone v1.0 this plugin is broken because the
DRONE_COMMIT_LINK environment variable is no longer being injected into the plugin container. There are several other null variables all listed below. Is there something I can do to get this variable back? Is it important to have the deployment id for lookup.
Empty vars in the plugin container:
I ran a quick test and was able to print most of these variables to the console:
+ echo $DRONE_COMMIT_LINK
+ echo $DRONE_COMMIT_AUTHOR_EMAIL
+ echo $DRONE_STAGE_VARIANT
+ echo $DRONE_COMMIT_AUTHOR_NAME
+ echo $DRONE_COMMIT_BEFORE
+ echo $DRONE_STAGE_MACHINE
It is expected that some variables will be empty. For example, the DRONE_STAGE_VARIANT is only populated if you set the variant attribute in the platform section of your yaml and the DRONE_STAGE_MACHINE is only populated if you named your runner.
You should make sure you are using the latest stable version of the runners. If you do not see these variables you may be using an outdated or deprecated image. For example if you are using the docker runner you should be using the
You can otherwise audit the relevant code and environment variables here:
My problem is the same as @Gufran’s in the gitter channel. Here’s the convo from March 2019. The variable exists in case of a
push event but not for
Brad Rydzewski @bradrydzewski Mar 13 2019 08:26
DRONE_COMMIT_LINK points to the github url
Mohammad Gufran @Gufran Mar 13 2019 08:27
@bradrydzewski it shows empty in case of deployment event.
Since this was removed I cannot get the deployment id from github in any of the existing environment variables. Can you please advise what the workaround should be @bradrydzewski? Thanks.
There is no commit URL included in the github deployment webhook , so I think it makes sense that this field is empty. I understand earlier versions of Drone stored the Deploy API Endpoint in this field, however, it did not really belong and it was considered technical debt that we did not want to carry forward in 1.x.
Drone does store the deployment ID  in its own field, so I think the next step would be to send a pull request to the runner-go library and include the deployment ID as its own unique environment variable .
Thanks for that explanation @ashwilliams1 I will take a look at the linked repos
@ashwilliams1 now that the PR has been merged can you provide an estimate for when that will be available on docker? Would like to keep using the drone images rather than building my own if possible. Thanks!
we just need to upgrade the dependency in the drone/drone-runner-docker repository, and then the image will be available automatically once the build pipeline finishes. I will try and make the update later today or tomorrow.
I just took care of updating the dependencies. A new image is now available.
I see the new image in https://hub.docker.com/r/drone/drone-runner-docker but I’m using the drone-runner-kube image. Can I get a new build of that one too. Thanks very much for your help with this! @ashwilliams1 any chance we can get this in the kube runner build also?
sorry, just saw this. traveling at the moment, but if you send a PR I can merge from my phone.
I was able to push an update earlier this morning.