Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ public String getFullProjectName() throws AbortException {
return build().getParent().getFullName();
}

@Whitelisted
public List<String> getLog(int maxLines) throws IOException {
return build().getLog(maxLines);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly bad for performance if the argument is large. On the other hand sometimes you would want the full log. jenkinsci/workflow-basic-steps-plugin#2 might provide a more scalable solution, at least for the common case of scanning for messages in the current build’s log after an error (this method could be used for other purposes, such as after a build step).

}

@Whitelisted
public @CheckForNull RunWrapper getPreviousBuild() throws AbortException {
Run<?,?> previousBuild = build().getPreviousBuild();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<dt><code>result</code></dt><dd>typically <code>SUCCESS</code>, <code>UNSTABLE</code>, or <code>FAILURE</code> (<em>may</em> be null for an ongoing build)</dd>
<dt><code>displayName</code></dt><dd>normally <code>#123</code> but sometimes set to, e.g., an SCM commit identifier</dd>
<dt><code>description</code></dt><dd>additional information about the build</dd>
<dt><code>log</code></dt><dd>console output of the build</dd>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a method, not a property, so must be documented differently.

<dt><code>id</code></dt><dd>normally <code>number</code> as a string</dd>
<dt><code>timeInMillis</code></dt><dd>time since the epoch when the build was scheduled</dd>
<dt><code>startTimeInMillis</code></dt><dd>time since the epoch when the build started running</dd>
Expand Down