【问题标题】:In Jenkins, on a Windows remote connected through Cygwin sshd, how to run an sh pipeline step?在 Jenkins 中,在通过 Cygwin sshd 连接的 Windows 远程设备上,如何运行 sh 管道步骤?
【发布时间】:2017-02-09 22:08:44
【问题描述】:

我们正在将 Jenkins 管道移植到 Windows 环境中。

Jenkins 的 master 使用 Cygwin sshd 连接到我们的 Windows 远程 - 命名为 winremote-。 如this page 所述,节点的Remote root directory 以普通Windows 路径的形式给出(在这种情况下,它设置为C:\cygwin64\home\jenkins\jenkins-slave-dir)

这个最小的管道示例:

    node("winremote")
    {
        echo "Entering Windows remote"
        sh "ls -l"
    }

因错误而失败:

[Pipeline] echo
Entering Windows rmeote
[Pipeline] sh
[C:\cygwin64\home\jenkins\jenkins-slave-dir\workspace\proto-platforms] Running shell script
sh: C:\cygwin64\home\jenkins\jenkins-slave-dir\workspace\proto-platforms@tmp\durable-a739272f\script.sh: command not found

通过 SSH 进入 Windows 远程,我可以看到 Jenkins 实际上在 C:\cygwin64\home\jenkins\jenkins-slave-dir 中创建了 workspace 子目录,但它是空的。

有没有已知的方法可以在这样的遥控器上使用sh 管道步骤?

【问题讨论】:

    标签: jenkins cygwin jenkins-pipeline


    【解决方案1】:

    一个PR from blatinville,在这个问题之后几个小时被合并,解决了第一个问题。 可悲的是,它引入了另一个问题,在票 JENKINS-41225 中描述,错误:

    nohup: failed to run command 'sh': No such file or directory
    

    本期有提议PR for a quickfix

    最后一个问题是,持久任务插件如何使用“ps”评估任务是否仍然存在,another PR fixing it

    临时解决方案

    在应用这些(或等效)修复之前,可以使用以下命令编译 Cygwin 兼容的持久任务插件:

    git clone https://github.com/Adnn/durable-task-plugin.git -b cygwin_fixes
    cd durable-task-plugin/
    mvn clean install -DskipTests
    

    特别是生成 target/durable-task.hpi 文件,该文件可用于替换 Jenkins 在其 中安装的 durable-task.jpi 文件>插件文件夹。然后需要重启 Jenkins。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-12-21
      • 2019-02-28
      • 1970-01-01
      • 1970-01-01
      • 2023-03-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多