Ola Eldøy
Ola Eldøy

Reputation: 5936

Jenkins Pipeline, PowerShell script hangs

I want to run a Powershell file from the Jenkins Pipeline, using the powershell command. Should be easy, right?

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

C:\HelloWorld.ps1 is a one-liner:

Write-Host "Hello World"

But running the job causes the process to hang. Here is the console output:

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

And then it just hangs until I cancel the job.

What to do?

Upvotes: 2

Views: 4976

Answers (4)

gabloe
gabloe

Reputation: 11

This issue should be fixed in the next release: https://github.com/jenkinsci/durable-task-plugin/pull/51

Upvotes: 1

Modesto San Juan
Modesto San Juan

Reputation: 11

I had the same issue and the problem was that the job had spaces in its name.

Upvotes: 1

I had the same issue and managed to solve it with downgrading DurableTask plugin from 1.17 to 1.15. It seems to be part of JENKINS-46496 bug. The older plugin version is there 1.15.

You can update the plugin to a needed version in Manage Plugins->Advanced Tab->Upload Plugin button.

Upvotes: 4

Ingemar
Ingemar

Reputation: 139

I have the same problem in about 70 % of my cases. I have a pipeline script that kicks off about 20 parallel jobs spread out over different agents. Each of these tries to run a Powershell script initially. About 30 % of the jobs succeed to run the script, the rest hangs just like it does for Ola.

The build agents are configured exactly the way (clones in a VM cluster). Powershell v4 is used. Upon several tries one single build agent sometimes succeeds in running Powershell, sometimes don't.

I've been running this pipeline for 5-6 weeks and it's just the last week this behavior has been seen. Fortunately the script isn't in production yet :-)

I haven't had the time to do a full investigation. Could it be that some of the pipeline plugins have been updated and introduced this bug?

Upvotes: 0

Related Questions