diff --git a/core/src/main/java/hudson/cli/BuildCommand.java b/core/src/main/java/hudson/cli/BuildCommand.java index 3f075e0410..055229c0bb 100644 --- a/core/src/main/java/hudson/cli/BuildCommand.java +++ b/core/src/main/java/hudson/cli/BuildCommand.java @@ -49,6 +49,8 @@ import java.util.ArrayList; import java.util.Map.Entry; import java.io.PrintStream; +import jenkins.model.Jenkins; + /** * Builds a job, and optionally waits until its completion. * @@ -102,7 +104,7 @@ public class BuildCommand extends CLICommand { } } - Future f = job.scheduleBuild2(0, new CLICause(), a); + Future f = job.scheduleBuild2(0, new CLICause(Jenkins.getAuthentication().getName()), a); if (!sync) return 0; AbstractBuild b = f.get(); // wait for the completion @@ -123,10 +125,20 @@ public class BuildCommand extends CLICommand { ); } - // TODO: CLI can authenticate as different users, so should record which user here.. public static class CLICause extends Cause { + + private String startedBy; + + public CLICause(){ + startedBy = "unknown"; + } + + public CLICause(String startedBy){ + this.startedBy = startedBy; + } + public String getShortDescription() { - return "Started by command line"; + return "Started by command line by " + startedBy; } @Override