[JIRA] (JENKINS-55596) PowerShell Plugin | Start-Job command creates TerminatingError(Import-Module)

2 views
Skip to first unread message

hans.redl@seidenader.de (JIRA)

unread,
Jan 15, 2019, 5:50:03 AM1/15/19
to jenkinsc...@googlegroups.com
Hans Redl created an issue
 
Jenkins / Bug JENKINS-55596
PowerShell Plugin | Start-Job command creates TerminatingError(Import-Module)
Issue Type: Bug Bug
Assignee: Unassigned
Components: powershell-plugin
Created: 2019-01-15 10:49
Environment: Windows Server 2016 Standard, Jenkins 2.150.1, powershell plugin,
Labels: TerminatingError powershell
Priority: Major Major
Reporter: Hans Redl

I want to execute a Job in Background and grab the test results after each test.

If I execute the script from the powershell console, everything works as it should, but if I execute the same script from Jenkins, I don't receive anything. The only output I see is:

(TRANSLATION)

PS>TerminatingError(Import-Module): "The Windows PowerShell-Workflow won't be supported in an x86-based Windows PowerShell-Console. Open a x64-based Windows PowerShell-Console and try again."

(ORIGINAL-german)

PS>TerminatingError(Import-Module): "Der Windows PowerShell-Workflow wird in einer x86-basierten Windows PowerShell-Konsole nicht unterstützt. Öffnen Sie eine x64-basierte Windows PowerShell-Konsole, und versuchen Sie es erneut."

The Jenkins function is as follows and will be executed for each unit test:
I marked the problematic code section in red (starting with $testJob).
 

 

function InvokeTest ($hostName, $test) {
    try {
        $urlTest = "http://$hostName/WsTest/$test"
        $testJob = Start-Job {param($url, $timeout) Invoke-WebRequest $url -TimeoutSec 30 -Method Get} -Arg $urlTest, $script:testTimeout
        while (1) {
            Start-Sleep -Seconds 2
            if ($testJob.State -eq "Failed") {
                $testExeStatus = "Test run aborted"
                $ErrorMessage = $testJob.ChildJobs[0].JobStateInfo.Reason.Message
                break
            }
            elseif ($testJob.State -eq "Completed") {
                $testExeStatus = "Test run completed"
                $testStatus = Receive-Job -Job $testJob
                $testResult += $testStatus.Content
                break
            }
        }
    }
    catch {
        $testExeStatus = "Test run aborted"
        $ErrorMessage = $_.Exception.Message
        break
    }
    finally {
        $testExeStatus
        $testResult
    }
}
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

hans.redl@seidenader.de (JIRA)

unread,
Jan 15, 2019, 6:19:03 AM1/15/19
to jenkinsc...@googlegroups.com
Hans Redl updated an issue
Change By: Hans Redl
I want to execute a Job in Background and grab the test results after each test.

If I execute the script from the powershell console, everything works as it should, but if I execute the same script from Jenkins, I don't receive anything. The only output I see is:

(TRANSLATION)
{code:java}

PS>TerminatingError(Import-Module): "The Windows PowerShell-Workflow won't be supported in an x86-based Windows PowerShell-Console. Open a x64-based Windows PowerShell-Console and try again."
{code}
(ORIGINAL-german)
{code:java}

PS>TerminatingError(Import-Module): "Der Windows PowerShell-Workflow wird in einer x86-basierten Windows PowerShell-Konsole nicht unterstützt. Öffnen Sie eine x64-basierte Windows PowerShell-Konsole, und versuchen Sie es erneut."
{code}

The Jenkins function is as follows and will be executed for each unit test:
I marked the The problematic code section in red (starting with is :
$testJob = Start-Job {param($url, $timeout ) . Invoke-WebRequest $url -TimeoutSec 30 -Method Get} -Arg $urlTest, $script:testTimeout
 

 
{code:java}

function InvokeTest ($hostName, $test) {
    try {
        $urlTest = "http://$hostName/WsTest/$test"
        $testJob = Start-Job {param($url, $timeout) Invoke-WebRequest $url -TimeoutSec 30 -Method Get} -Arg $urlTest, $script:testTimeout
        while (1) {
            Start-Sleep -Seconds 2
            if ($testJob.State -eq "Failed") {
                $testExeStatus = "Test run aborted"
                $ErrorMessage = $testJob.ChildJobs[0].JobStateInfo.Reason.Message
                break
            }
            elseif ($testJob.State -eq "Completed") {
                $testExeStatus = "Test run completed"
                $testStatus = Receive-Job -Job $testJob
                $testResult += $testStatus.Content
                break
            }
        }
    }
    catch {
        $testExeStatus = "Test run aborted"
        $ErrorMessage = $_.Exception.Message
        break
    }
    finally {
        $testExeStatus
        $testResult
    }
}{code}

hans.redl@seidenader.de (JIRA)

unread,
Jan 15, 2019, 6:21:02 AM1/15/19
to jenkinsc...@googlegroups.com
Hans Redl updated an issue
I want to execute a Job in Background and grab the test results after each test.

If I execute the script from the powershell console, everything works as it should, but if I execute the same script from Jenkins, I don't receive anything. The only output I see is:

(TRANSLATION)
{code:java}
PS>TerminatingError(Import-Module): "The Windows PowerShell-Workflow won't be supported in an x86-based Windows PowerShell-Console. Open a x64-based Windows PowerShell-Console and try again."
{code}
(ORIGINAL-german)
{code:java}
PS>TerminatingError(Import-Module): "Der Windows PowerShell-Workflow wird in einer x86-basierten Windows PowerShell-Konsole nicht unterstützt. Öffnen Sie eine x64-basierte Windows PowerShell-Konsole, und versuchen Sie es erneut."
{code}
The Jenkins function is as follows and will be executed for each unit test:
The problematic code section is :


$testJob = Start-Job \ {param($url, $timeout) Invoke-WebRequest $url -TimeoutSec 30 -Method Get} -Arg $urlTest, $script:testTimeout

ddigtiar@cloudbees.com (JIRA)

unread,
Sep 3, 2019, 12:21:01 AM9/3/19
to jenkinsc...@googlegroups.com
Denys Digtiar commented on Bug JENKINS-55596
 
Re: PowerShell Plugin | Start-Job command creates TerminatingError(Import-Module)

It sounds like the agent might be running on the 32-bit Java, therefore when it launches the PowerShell process it uses the 32-bit PowerShell. However, based on the error, the PowerShell-Workflow requires a 64-bit PowerShell. Hence, the solution is probably to install the 64-bit Java and make sure that the agent uses it.

hans.redl@seidenader.de (JIRA)

unread,
Sep 3, 2019, 1:46:01 AM9/3/19
to jenkinsc...@googlegroups.com

Hi Denys Digtiar,

thank you for your comment. Due the time I managed to catch the test results in a different way, to avoid this Start-Job command.

However, I'll test your suggestions and come back to you, if the 64-bit Java was the solution.

 

Reply all
Reply to author
Forward
0 new messages