Set of environment variables that describe the user who started the build.
The plugin provides the following environment variables:
| Variable | Description |
|---|---|
| BUILD_USER | Full name (first name + last name) |
| BUILD_USER_FIRST_NAME | First name |
| BUILD_USER_LAST_NAME | Last name |
| BUILD_USER_ID | Jenkins user ID |
| BUILD_USER_GROUPS | Jenkins user groups |
| BUILD_USER_EMAIL | Email address |
Set the global option to add build user variables to the environment for all builds (in Manage Jenkins, Configure System).
Select Set Jenkins user build variables and reference the variables during the build:
node {
withBuildUser {
def user = env.BUILD_USER_ID
}
}
or with declarative option:
options {
withBuildUser()
}
When builds are triggered automatically (not by a human user), the plugin sets dummy values for the core build user variables:
| Trigger Type | BUILD_USER | BUILD_USER_FIRST_NAME | BUILD_USER_LAST_NAME | BUILD_USER_ID |
|---|---|---|---|---|
| Timer Trigger | "Timer Trigger" | "Timer" | "Trigger" | "timer" |
| SCM Trigger | "SCM Change" | "SCM" | "Change" | "scmChange" |
| Branch Indexing | "Branch Indexing" | "Branch" | "Indexing" | "branchIndexing" |
| Remote Trigger | "{host} {note}" | "{host}" | "{note}" | "remoteRequest" |
| Generic Webhook Trigger | "Generic Webhook Trigger" | "Generic" | "Webhook" | "genericWebhook" |
- BUILD_USER_ID values are consistent identifiers you can rely on for automation detection.
- BUILD_USER_GROUPS and BUILD_USER_EMAIL are not set for automated triggers.
Release notes have been available in GitHub Releases since July 2020 (build-user-vars plugin 1.6 and later). Prior release notes are available in the plugin repository changelog.
