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
Nested ClassesModifier and TypeClassDescriptionprotected static classTails a log file and watches for an exit status file.Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidRequests that a specified charset be used to transcode process output.final voidRequests 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 AgentInfogetAgentInfo(FilePath nodeRoot) protected static FilePathgetNodeRoot(FilePath workspace) final Controllerlaunch(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 FilePathrequestBinary(FilePath nodeRoot, AgentInfo agentInfo, FilePath ws, FileMonitoringTask.FileMonitoringController c) Returns path of binary on agent.protected static FilePathReturns 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:DurableTaskLaunches a durable task.- Specified by:
launchin 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:
IOExceptionInterruptedException
-
launchWithCookie
protected FileMonitoringTask.FileMonitoringController launchWithCookie(FilePath workspace, Launcher launcher, TaskListener listener, EnvVars envVars, String cookieVariable, String cookieValue) throws IOException, InterruptedException - Throws:
IOExceptionInterruptedException
-
charset
Description copied from class:DurableTaskRequests 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:
charsetin classDurableTask- Parameters:
cs- the character set in which process output is expected to be
-
defaultCharset
public final void defaultCharset()Description copied from class:DurableTaskRequests 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:
defaultCharsetin 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:
IOExceptionInterruptedException
-
escape
JENKINS-40734: blocks the substitutions ofEnvVars.overrideExpandingAll(java.util.Map<java.lang.String, java.lang.String>)done byLauncher. -
getNodeRoot
- Throws:
IOException
-
getAgentInfo
- Throws:
IOExceptionInterruptedException
-
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:
IOExceptionInterruptedException
-
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:
IOExceptionInterruptedException
-