我们正在使用 Jenkins Blue Ocean 在 Windows 2012 r2 Jenkins Slaves 上构建 .Net 应用程序。我们Jenkinsfile
在 git repos 中使用 a 来定义构建管道。
对于几个项目,由于工作区构建路径太长,Windows 无法处理,我们会遇到构建失败。
这通常发生在最大化最大路径的命令中nuget pack
。npm 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的上下文中看到。