diff --git a/core/src/main/java/hudson/cli/BuildCommand.java b/core/src/main/java/hudson/cli/BuildCommand.java index 6f9cf2dae48c970ebc64a25983d1a313f8e16a41..16591e916a3e67f01399c24216c20191d8ae41cc 100644 --- a/core/src/main/java/hudson/cli/BuildCommand.java +++ b/core/src/main/java/hudson/cli/BuildCommand.java @@ -32,7 +32,9 @@ import hudson.model.ParametersDefinitionProperty; import hudson.model.ParameterDefinition; import hudson.Extension; import hudson.AbortException; +import hudson.console.ModelHyperlinkNote; import hudson.model.Item; +import hudson.model.TaskListener; import hudson.model.queue.QueueTaskFuture; import hudson.scm.PollingResult.Change; import hudson.util.EditDistance; @@ -158,6 +160,12 @@ public class BuildCommand extends CLICommand { return "Started by command line by " + startedBy; } + @Override + public void print(TaskListener listener) { + listener.getLogger().println("Started by command line by " + + ModelHyperlinkNote.encodeTo("/user/"+getUserId(), getUserName())); + } + @Override public boolean equals(Object o) { return o instanceof CLICause; diff --git a/test/src/test/groovy/hudson/cli/BuildCommandTest.groovy b/test/src/test/groovy/hudson/cli/BuildCommandTest.groovy index 16eace5242c93c9a750e65176de82aad060536c4..aeea843a49837c80d7f6e4201131017914fe1739 100644 --- a/test/src/test/groovy/hudson/cli/BuildCommandTest.groovy +++ b/test/src/test/groovy/hudson/cli/BuildCommandTest.groovy @@ -105,7 +105,7 @@ public class BuildCommandTest extends HudsonTestCase { def o = new ByteArrayOutputStream() cli.execute(["build","-s","-v",p.name],System.in,new TeeOutputStream(System.out,o),System.err) assertBuildStatusSuccess(p.getBuildByNumber(1)) - assertTrue(o.toString().contains("Started by command line by anonymous")) + assertTrue(o.toString(), o.toString().contains("Started by command line by anonymous")) assertTrue(o.toString().contains("Finished: SUCCESS")) } finally { cli.close()