diff --git a/README.md b/README.md index d3f99a6..21b1c0b 100644 --- a/README.md +++ b/README.md @@ -35,12 +35,20 @@ Select *Set Jenkins user build variables* and reference the variables during the ```groovy node { - wrap([$class: 'BuildUser']) { + withBuildUser { def user = env.BUILD_USER_ID } } ``` +or with declarative option: + +```groovy +options { + withBuildUser() +} +``` + ## Changelog Release notes are available in [GitHub Releases](https://github.com/jenkinsci/build-user-vars-plugin/releases) since July 2020 (build-user-vars plugin 1.6 and later). diff --git a/src/main/java/org/jenkinsci/plugins/builduser/BuildUser.java b/src/main/java/org/jenkinsci/plugins/builduser/BuildUser.java index 60cb3f1..f4f575d 100644 --- a/src/main/java/org/jenkinsci/plugins/builduser/BuildUser.java +++ b/src/main/java/org/jenkinsci/plugins/builduser/BuildUser.java @@ -20,6 +20,7 @@ import jenkins.branch.BranchIndexingCause; import jenkins.model.Jenkins; import jenkins.tasks.SimpleBuildWrapper; +import org.jenkinsci.Symbol; import org.jenkinsci.plugins.builduser.varsetter.IUsernameSettable; import org.jenkinsci.plugins.builduser.varsetter.impl.*; import org.kohsuke.accmod.Restricted; @@ -134,6 +135,7 @@ private static void handleOtherCausesOrLogWarningIfUnhandled(@NonNull Run } @Extension + @Symbol("withBuildUser") public static class DescriptorImpl extends BuildWrapperDescriptor { @Override public boolean isApplicable(AbstractProject item) {