Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-55596

PowerShell Plugin | Start-Job command creates TerminatingError(Import-Module)

      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:
      The problematic code section is :

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

       

      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
          }
      }
      

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

          Hans Redl created issue -
          Hans Redl made changes -
          Description Original: 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 problematic code section in red (starting with $testJob).
            

           
          {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}
          New: 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
            

           
          {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 made changes -
          Description Original: 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
            

           
          {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}
          New: 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

           
          {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}

            Unassigned Unassigned
            sdm_jenkinsuser Hans Redl
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: