【问题标题】:jenkins custom plugin java code to read a file from slave machinejenkins 自定义插件 java 代码从从机读取文件
【发布时间】:2021-08-31 20:58:48
【问题描述】:

jenkins 自定义 jenkins 插件代码无法从从机读取文件。它正在抛出 FileNotFound 异常。

FilePath filePath = build.getWorkspace();
boolean isRemoteExecution = filePath.isRemote();
        if (isRemoteExecution) {
                        Callable<StringBuilder, IOException> callable = executeComparison(currentBuildInfo, benchmarkBuildInfo,
                    previousSuccessfulBuildNumber, histogramBuildInfoList, workspaceFolder, jobName, taskListener);
            VirtualChannel channel = launcher.getChannel();
            channel.call(callable);
        }

【问题讨论】:

  • 以上代码中的executeComparison方法如下

标签: jenkins-plugins master-slave


【解决方案1】:

你可以试试这个:

{  
  FilePath projectWorkspaceOnSlave = new FilePath(launcher.getChannel(), pathToLocalFile);
  return projectWorkspaceOnSlave.absolutize();
}

这对我有用

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-08-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多