Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Jenkins EnvInject script to inject the User ID and name of the person that started the Build
def map = [BUILD_USER_ID: "unknown", BUILD_USER_NAME:"Unknown"]
try {
def cause = currentBuild.getCause(hudson.model.Cause.UserIdCause.class)
if (cause != null) {
map.BUILD_USER_ID = cause.userId
map.BUILD_USER_NAME = cause.userName
}
} catch (Throwable t) {
out.println(t)
}
return map
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.