Package org.jenkinsci.plugins.workflow
Class FilePathUtils
java.lang.Object
org.jenkinsci.plugins.workflow.FilePathUtils
Candidates for inclusion in
FilePath
.
TODO JENKINS-26096-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic FilePath
Attempts to create a live file handle based on persistable data.static String
Same asgetNodeNameOrNull(hudson.FilePath)
but throws a diagnostic exception in case of failure.static String
Looks up theNode.getNodeName()
corresponding to a given file.
-
Method Details
-
getNodeNameOrNull
Looks up theNode.getNodeName()
corresponding to a given file. Compared toFilePath.toComputer()
this has two advantages:- it will still report a configured agent name even if the agent was subsequently disconnected (i.e., the
FilePath
is invalid) - it will still report a node name even if the agent is connected but currently has no executors
- Parameters:
f
- a file, possibly remote- Returns:
- a node name (
""
for the controller), if known, else null
- it will still report a configured agent name even if the agent was subsequently disconnected (i.e., the
-
getNodeName
Same asgetNodeNameOrNull(hudson.FilePath)
but throws a diagnostic exception in case of failure.- Parameters:
f
- a file, possible remote- Returns:
- a node name (
""
for the controller), if known - Throws:
IllegalStateException
- if the association to a node is unknown
-
find
Attempts to create a live file handle based on persistable data.- Parameters:
node
- a name as returned bygetNodeName(hudson.FilePath)
path
- a path as returned byFilePath.getRemote()
- Returns:
- a corresponding file handle, if a node with that name is online, else null
-