6

我们正在使用 Jenkins Blue Ocean 在 Windows 2012 r2 Jenkins Slaves 上构建 .Net 应用程序。我们Jenkinsfile在 git repos 中使用 a 来定义构建管道。

对于几个项目,由于工作区构建路径太长,Windows 无法处理,我们会遇到构建失败。
这通常发生在最大化最大路径的命令中nuget packnpm install

The specified path, file name, or both are too long. 
The fully qualified file name must be less than 260 characters, 
and the directory name must be less than 248 characters.

script returned exit code 1

由于我们无法影响 Visual Studio 解决方案 nuget 包路径的长度,我们如何将工作区文件夹放到 Windows 可以处理的位置?


感谢 Mutsa 的建议,我们最终在 Jenkinsfile 中得到了这样的结果:

pipeline {
agent {
    node {
        label 'win'
        customWorkspace "ws\\${JOB_NAME.replace("%2F", "_")}"
    }
}

这可以在我们GitHub 上的 .net core Wakeboard UK 网站 repo的上下文中看到。

4

2 回答 2

3

对于声明性管道,使用customworksace选项覆盖节点、docker 或 dockerfile 部分中的默认路径。见例子。

agent {
node {
    customWorkspace '/some/other/path'
}

它可以是相对于工作空间根的相对路径或绝对路径。

于 2017-07-07T10:05:44.400 回答
0

您始终可以自定义工作区路径并指向目录

于 2017-05-20T11:01:37.060 回答