我们正在使用Jenkins Blue Ocean在Windows 2012 R2 Jenkins Slaves上构build.Net应用程序。 我们在git Jenkinsfile
使用Jenkinsfile
来定义构buildpipe道。
由于工作空间的构buildpath对于Windows来说太长,所以有一些项目会导致构build失败。
这通常发生在nuget pack
和npm install
命令中,这些命令nuget pack
超出了最大path。
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 Solution nuget包path的长度,所以我们如何将工作空间文件夹放到Windows可以处理的地方?
对于声明式管道,使用customworksace选项来覆盖节点,docker或dockerfile部分中的默认路径。 看例子。
agent { node { customWorkspace '/some/other/path' }
它可以是相对于工作空间根或绝对路径的相对路径。
您始终可以自定义工作区路径并指向该目录