Interface LogStorage
-
- All Known Implementing Classes:
BrokenLogStorage
,FileLogStorage
@Restricted(org.kohsuke.accmod.restrictions.Beta.class) public interface LogStorage
Means of replacing how logs are stored for a Pipeline build as a whole or for one step. UTF-8 encoding is assumed throughout.- See Also:
- JEP-210: Pluggable log storage
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description static String
endStep()
Closes an HTML step block.default File
getLogFile(FlowExecutionOwner.Executable build, boolean complete)
Deprecated.Only used for compatibility withRun.getLogFile()
.TaskListener
nodeListener(FlowNode node)
Provides an alternate way of emitting output from a node (such as a step).static LogStorage
of(FlowExecutionOwner b)
Gets the available log storage method for a given build.BuildListener
overallListener()
Provides an alternate way of emitting output from a build.AnnotatedLargeText<FlowExecutionOwner.Executable>
overallLog(FlowExecutionOwner.Executable build, boolean complete)
Provides an alternate way of retrieving output from a build.static String
startStep(String id)
Introduces an HTML block with apipeline-node-<ID>
CSS class based onFlowNode.getId()
.AnnotatedLargeText<FlowNode>
stepLog(FlowNode node, boolean complete)
Provides an alternate way of retrieving output from a build.
-
-
-
Method Detail
-
overallListener
@NonNull BuildListener overallListener() throws IOException, InterruptedException
Provides an alternate way of emitting output from a build.May implement
AutoCloseable
to clean up at the end of a build; it may or may not be closed during Jenkins shutdown while a build is running.The caller may wrap the result using
TaskListenerDecorator.apply(hudson.model.TaskListener, org.jenkinsci.plugins.workflow.flow.FlowExecutionOwner, org.jenkinsci.plugins.workflow.log.TaskListenerDecorator)
.- Returns:
- a (remotable) build listener; do not bother overriding anything except
TaskListener.getLogger()
- Throws:
IOException
InterruptedException
- See Also:
FlowExecutionOwner.getListener()
-
nodeListener
@NonNull TaskListener nodeListener(@NonNull FlowNode node) throws IOException, InterruptedException
Provides an alternate way of emitting output from a node (such as a step).May implement
AutoCloseable
to clean up at the end of a node (FlowNode.isActive()
); it may or may not be closed during Jenkins shutdown while a build is running.The caller may wrap the result using
TaskListenerDecorator.apply(hudson.model.TaskListener, org.jenkinsci.plugins.workflow.flow.FlowExecutionOwner, org.jenkinsci.plugins.workflow.log.TaskListenerDecorator)
.- Parameters:
node
- a running node- Returns:
- a (remotable) task listener; do not bother overriding anything except
TaskListener.getLogger()
- Throws:
IOException
InterruptedException
- See Also:
StepContext.get(java.lang.Class<T>)
-
overallLog
@NonNull AnnotatedLargeText<FlowExecutionOwner.Executable> overallLog(@NonNull FlowExecutionOwner.Executable build, boolean complete)
Provides an alternate way of retrieving output from a build.In an
AnnotatedLargeText.writeHtmlTo(long, java.io.Writer)
override,ConsoleAnnotationOutputStream.eol(byte[], int)
should applystartStep(java.lang.String)
andendStep()
to delineate blocks contributed by steps. (Also seeConsoleAnnotators
.)- Parameters:
complete
- if true, we claim to be serving the complete log for a build, so implementations should be sure to retrieve final log lines- Returns:
- a log
-
startStep
@NonNull static String startStep(@NonNull String id)
Introduces an HTML block with apipeline-node-<ID>
CSS class based onFlowNode.getId()
.
-
endStep
@NonNull static String endStep()
Closes an HTML step block.
-
stepLog
@NonNull AnnotatedLargeText<FlowNode> stepLog(@NonNull FlowNode node, boolean complete)
Provides an alternate way of retrieving output from a build.- Parameters:
node
- a running nodecomplete
- if true, we claim to be serving the complete log for a node, so implementations should be sure to retrieve final log lines- Returns:
- a log for this just this node
- See Also:
LogAction
-
getLogFile
@Deprecated @NonNull default File getLogFile(@NonNull FlowExecutionOwner.Executable build, boolean complete)
Deprecated.Only used for compatibility withRun.getLogFile()
.Provide a file containing the log text. The default implementation creates a temporary file based on the current contents ofoverallLog(org.jenkinsci.plugins.workflow.flow.FlowExecutionOwner.Executable, boolean)
.- Parameters:
build
- as inoverallLog(org.jenkinsci.plugins.workflow.flow.FlowExecutionOwner.Executable, boolean)
complete
- as inoverallLog(org.jenkinsci.plugins.workflow.flow.FlowExecutionOwner.Executable, boolean)
- Returns:
- a possibly temporary file
-
of
@NonNull static LogStorage of(@NonNull FlowExecutionOwner b)
Gets the available log storage method for a given build.- Parameters:
b
- a build about to start- Returns:
- the mechanism for handling this build, including any necessary fallback
- See Also:
LogStorageFactory
-
-