Added actual user who started the build.

This commit is contained in:
Vojtech Juranek committed 2012-01-23 15:27:04 +01:00
1 parent 3a5b72ce57
commit f8387f441d
1 file changed
+15 -3
@@ -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<? extends AbstractBuild> f = job.scheduleBuild2(0, new CLICause(), a);
Future<? extends AbstractBuild> 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