Class FileMonitoringTask
java.lang.Object
hudson.model.AbstractDescribableImpl<DurableTask>
org.jenkinsci.plugins.durabletask.DurableTask
org.jenkinsci.plugins.durabletask.FileMonitoringTask
- All Implemented Interfaces:
ExtensionPoint
,Describable<DurableTask>
- Direct Known Subclasses:
BourneShellScript
,PowershellScript
,WindowsBatchScript
A task which forks some external command and then waits for log and status files to be updated/created.
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
Tails a log file and watches for an exit status file.Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
Requests that a specified charset be used to transcode process output.final void
Requests that the node’s system charset be used to transcode process output.doLaunch
(FilePath workspace, Launcher launcher, TaskListener listener, EnvVars envVars) Should start a process which sends output to log file in the workspace and finally writes its exit code to result file.JENKINS-40734: blocks the substitutions ofEnvVars.overrideExpandingAll(java.util.Map<java.lang.String, java.lang.String>)
done byLauncher
.protected static AgentInfo
getAgentInfo
(FilePath nodeRoot) protected static FilePath
getNodeRoot
(FilePath workspace) final Controller
launch
(EnvVars env, FilePath workspace, Launcher launcher, TaskListener listener) Launches a durable task.launchWithCookie
(FilePath workspace, Launcher launcher, TaskListener listener, EnvVars envVars, String cookieVariable, String cookieValue) protected static FilePath
requestBinary
(FilePath nodeRoot, AgentInfo agentInfo, FilePath ws, FileMonitoringTask.FileMonitoringController c) Returns path of binary on agent.protected static FilePath
Returns path of binary on agent.Methods inherited from class org.jenkinsci.plugins.durabletask.DurableTask
captureOutput, getDescriptor
-
Field Details
-
COOKIE
- See Also:
-
BINARY_RESOURCE_PREFIX
- See Also:
-
-
Constructor Details
-
FileMonitoringTask
public FileMonitoringTask()
-
-
Method Details
-
launch
public final Controller launch(EnvVars env, FilePath workspace, Launcher launcher, TaskListener listener) throws IOException, InterruptedException Description copied from class:DurableTask
Launches a durable task.- Specified by:
launch
in classDurableTask
- Parameters:
env
- basic environment variables to use during launchworkspace
- the workspace to uselauncher
- a way to start processeslistener
- log output for the build- Returns:
- a way to check up on the task’s subsequent status
- Throws:
IOException
InterruptedException
-
launchWithCookie
protected FileMonitoringTask.FileMonitoringController launchWithCookie(FilePath workspace, Launcher launcher, TaskListener listener, EnvVars envVars, String cookieVariable, String cookieValue) throws IOException, InterruptedException - Throws:
IOException
InterruptedException
-
charset
Description copied from class:DurableTask
Requests that a specified charset be used to transcode process output. The encoding ofController.writeLog(hudson.FilePath, java.io.OutputStream)
andController.getOutput(hudson.FilePath, hudson.Launcher)
is then presumed to be UTF-8. If not called, no translation is performed.- Overrides:
charset
in classDurableTask
- Parameters:
cs
- the character set in which process output is expected to be
-
defaultCharset
public final void defaultCharset()Description copied from class:DurableTask
Requests that the node’s system charset be used to transcode process output. The encoding ofController.writeLog(hudson.FilePath, java.io.OutputStream)
andController.getOutput(hudson.FilePath, hudson.Launcher)
is then presumed to be UTF-8. If not called, no translation is performed.- Overrides:
defaultCharset
in classDurableTask
-
doLaunch
protected FileMonitoringTask.FileMonitoringController doLaunch(FilePath workspace, Launcher launcher, TaskListener listener, EnvVars envVars) throws IOException, InterruptedException Should start a process which sends output to log file in the workspace and finally writes its exit code to result file.- Parameters:
workspace
- the workspace to uselauncher
- a way to launch processeslistener
- build console logenvVars
- recommended environment for the subprocess- Returns:
- a specialized controller
- Throws:
IOException
InterruptedException
-
escape
JENKINS-40734: blocks the substitutions ofEnvVars.overrideExpandingAll(java.util.Map<java.lang.String, java.lang.String>)
done byLauncher
. -
getNodeRoot
- Throws:
IOException
-
getAgentInfo
- Throws:
IOException
InterruptedException
-
requestBinary
@CheckForNull protected static FilePath requestBinary(FilePath ws, FileMonitoringTask.FileMonitoringController c) throws IOException, InterruptedException Returns path of binary on agent. Copies binary to agent if it does not exist- Throws:
IOException
InterruptedException
-
requestBinary
@CheckForNull protected static FilePath requestBinary(FilePath nodeRoot, AgentInfo agentInfo, FilePath ws, FileMonitoringTask.FileMonitoringController c) throws IOException, InterruptedException Returns path of binary on agent. Copies binary to agent if it does not exist- Throws:
IOException
InterruptedException
-