1
0
mirror of https://github.com/firstBitMarksistskaya/jenkins-lib.git synced 2024-12-13 11:27:08 +02:00

Передача в аллюр относительного пути

This commit is contained in:
Nikita Gryzlov 2020-10-21 14:20:38 +03:00
parent ebba596446
commit c40c9d1f61
No known key found for this signature in database
GPG Key ID: C1EAE411FEF0BF2F
2 changed files with 10 additions and 2 deletions

View File

@ -36,10 +36,10 @@ class PublishAllure implements Serializable {
Logger.println(allurePath.listDirectories().toString())
allurePath.listDirectories().each { FilePath filePath ->
results.add(filePath.getRemote())
results.add(FileUtils.getLocalPath(filePath))
}
if (results.isEmpty()) {
results.add(allurePath.getRemote())
results.add(FileUtils.getLocalPath(allurePath))
}
Logger.println(results.toString())

View File

@ -24,4 +24,12 @@ class FileUtils {
return new FilePath(Jenkins.getInstanceOrNull().getComputer(nodeName).getChannel(), path);
}
}
static String getLocalPath(FilePath filePath) {
IStepExecutor steps = ContextRegistry.getContext().getStepExecutor()
def env = steps.env();
return filePath.getRemote().replaceAll("^$env.WORKSPACE/", "").toString()
}
}