windows - Jenkins Blue Ocean 工作区路径太长

标签 windows jenkins .net-core jenkins-pipeline jenkins-blueocean

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

由于工作区构建路径太长,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", "_")}"
    }
}

可以在我们的 .net 核心中的上下文中看到 Wakeboard UK website repo在 GitHub 上。

最佳答案

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

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

它可以是相对于工作区根目录的相对路径,也可以是绝对路径。

关于windows - Jenkins Blue Ocean 工作区路径太长,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44066894/

相关文章:

windows - 具有唯一 ID 的 SetTimer

eclipse - Atlassian SourceTree自定义 Action 对比

c++ - 如何在 Windows C++ 中创建带标题栏的无边框窗口

Jenkins 为从其他现有作业复制的新作业创建了错误的文件夹

C#编译错误: Can't find main from *. csproj文件

c# - IPartition 在 .NET Core 中有什么作用?

Python - Windows SystemParametersInfoW 与 SystemParametersInfoA 函数之间的区别

java - 如果在第一个作业之后我们在控制台输出中获得了特定值,如何在 Jenkins 中运行第二个作业

jenkins - 为 Jenkins/违规使用生成 PEP8 xml 报告

c# - 将 Excel 连接到 .Net Core v1.1 OData v4 时出现异常 添加至少一种媒体类型?