[Feature request] expose user who promoted build via environment variable

It would be nice to have access to the user who promoted a build via an environment variable, similar to DRONE_COMMIT_AUTHOR for who made the commit. Perhaps DRONE_PROMOTE_USER or DRONE_DEPLOY_USER (to go with DRONE_DEPLOY_TO)? something like that? It would probably just be empty for non-promote events. We’re looking for a way to attribute changes made by the CI system to the user who actually triggered the deployment.

Thanks,
Todd

I believe you can use DRONE_BUILD_TRIGGER which is set to the user that promoted or rolled back the build.

That would work too, but that’s not listed in the docs or at https://github.com/harness/drone/blob/master/operator/runner/env.go so I don’t think it’s available.

the file you mentioned is deprecated. this is the relevant code that injects environment variables:
https://github.com/drone/runner-go/blob/master/environ/environ.go

but agreed that it should be included in docs

1 Like

It looks like DRONE_BUILD_TRIGGER is only available within the step environments, and not available for substitution within the .drone.yml file. In fact we get this error when we try to use it for substitution: