1
0

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

This commit is contained in:
Nikita Gryzlov
2020-10-21 14:20:38 +03:00
committed by kuzja086
parent d6e3b02085
commit 1dbf4dce47
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()
}
}