[英]PowerShell script called from within the Jenkins PowerShell build step hangs indefinitely
I have a Jenkins (1.493) project that uses the Jenkins PowerShell build step to execute a PowerShell script. 我有一个Jenkins(1.493)项目,该项目使用Jenkins PowerShell构建步骤来执行PowerShell脚本。 Inside that script I want to invoke another script that is stored inside a file.
在该脚本中,我想调用存储在文件中的另一个脚本。 I have now reduced it to the following:
我现在将其简化为以下内容:
Script inside Jenkins PowerShell build step: Jenkins PowerShell构建步骤中的脚本:
& "\\\\stemmer.local\\sidevelopment\\cvdev\\devbase\\jenkins\\PowerShell\\Test.ps1"
Content of Test.ps1: Test.ps1的内容:
write-host 'Hello world!'
Whenever this Jenkins project executes, the PowerShell build step hangs indefinitely. 每当执行此Jenkins项目时,PowerShell构建步骤都会无限期挂起。
Things I have tried/verified so far: 到目前为止,我尝试过/验证过的事情:
Test.ps1
shows me that the Jenkins PowerShell script is being execute normally up to the point where Test.ps1
is called. Test.ps1
显示我的詹金斯PowerShell脚本正在正常执行到哪里点Test.ps1
被调用。 Test.ps1
exists and is reachable from the build slave that executes the script. Test.ps1
存在,并且可以从执行脚本的生成从服务器访问。 If I alter the file's name, I get the expected error message from PowerShell... &
does not help. &
也无济于事。 Test.ps1
can be executed properly from the powershell itself using the same command line that is being used in the Jenkins PowerShell script. Test.ps1
。 unrestricted
on my development host as well as on the Jenkins build slave. unrestricted
。 powershell.exe -InputFormat None -File "\\\\stemmer.local\\sidevelopment\\cvdev\\devbase\\jenkins\\PowerShell\\Test.ps1"
I only found few references to problems that sounded similar, but none of the approaches mentioned elsewhere did help me fix this. 我只发现很少有人听起来相似的问题,但是其他地方提到的方法都没有帮助我解决此问题。 I am absolutely puzzled, and wondering whether someone encountered this issue before (and maybe even got a scenario like the one I have in mind running).
我完全感到困惑,想知道是否有人之前遇到过此问题(甚至可能遇到了我想到的那种情况)。
Thanks a lot for any input! 非常感谢您的任何投入!
Volker
have you tried to set execution policy to bypass ? 您是否尝试将执行策略设置为绕过?
Copy the script file locally, then invoke it from within the Jenkins
PowerShell
plugin - that way it works as expected. 将脚本文件复制到本地,然后在
Jenkins
PowerShell
插件中调用它-这样可以按预期工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.