powershell - Jenkins 管道,PowerShell 脚本挂起

标签 powershell jenkins-pipeline

我想使用 powershell 命令从 Jenkins 管道运行 Powershell 文件。应该很容易吧?

node()
{
    stage ('Hello World') {
        powershell returnStatus: true, script: 'C:\\HelloWorld.ps1'
    }   
}

C:\HelloWorld.ps1 是一行:

Write-Host "Hello World"

但是运行作业会导致进程挂起。这是控制台输出:

Started by user Administrator
[Pipeline] node
Running on master in C:\Jenkins\workspace\HelloWorld
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Hello World)
[Pipeline] powershell
[HelloWorld] Running PowerShell script

然后它就会挂起,直到我取消该作业。

要做什么?

最佳答案

我遇到了同样的问题,并设法通过将 DurableTask 插件从 1.17 降级到 1.15 来解决它。它似乎是 JENKINS-46496 的一部分漏洞。旧的插件版本在那里 1.15 .

您可以在管理插件->高级选项卡->上传插件按钮中将插件更新到所需版本。

关于powershell - Jenkins 管道,PowerShell 脚本挂起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47527274/

相关文章:

powershell.exe start-process -About "\"当使用动词选项时

powershell - 从文件导入脚本 block

git - Jenkins 管道抛出 java.io.NotSerializableException : org. jenkinsci.plugins.workflow.job.WorkflowRun 即使使用 @NonCPS

jenkins - 在 Jenkins 作业中显示工作区下文件的时间戳

shell - jenkinsfile 中意外标记 `(' 附近出现语法错误

powershell - 为什么 PowerShell 的 `Get-ChildItem` 命令将参数 `d` 解析为 `Depth` ?

azure - 是否可以使用 PowerShell 脚本创建 Azure Databricks 集群?

powershell - 如何在 PowerShell 中使用 LinearGradientBrush 填充矩形?

jenkins - 如何在 jenkins 上并行运行动态阶段,并为每个阶段使用单独的 kubernetes 代理

jenkins - 找不到管道编辑器了