当前位置: 首页 > 知识库问答 >
问题:

Jenkins错误:Powershell与Jenkins的集成

璩珂
2023-03-14

我想把PowerShell和Jenkins集成起来。我发现很难解决这个错误,因为我的PowerShell脚本作业失败了,如下所示。

[own-machine-powershell-job] $ powershell.exe -NonInteractive -ExecutionPolicy ByPass "& 'C:\Windows\TEMP\hudson3566059468296731803.ps1'"
The system cannot find the file specified
FATAL: command execution failed
java.io.IOException: Cannot run program "powershell.exe" (in directory "C:\jenkins\workspace\own-machine-powershell-job"): CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessBuilder.start(Unknown Source)
    at hudson.Proc$LocalProc.(Proc.java:244)
    at hudson.Proc$LocalProc.(Proc.java:216)
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:816)
    at hudson.Launcher$ProcStarter.start(Launcher.java:382)
    at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1149)
    at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1114)
    at hudson.remoting.UserRequest.perform(UserRequest.java:120)
    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    at hudson.remoting.Request$2.run(Request.java:326)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at hudson.remoting.Engine$1$1.run(Engine.java:62)
    at java.lang.Thread.run(Unknown Source)
    at ......remote call to Powershell-Job(Native Method)
    at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1416)
    at hudson.remoting.UserResponse.retrieve(UserRequest.java:220)
    at hudson.remoting.Channel.call(Channel.java:781)
    at hudson.Launcher$RemoteLauncher.launch(Launcher.java:929)
    at hudson.Launcher$ProcStarter.start(Launcher.java:382)
    at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:97)
    at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:66)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:785)
    at hudson.model.Build$BuildExecution.build(Build.java:205)
    at hudson.model.Build$BuildExecution.doRun(Build.java:162)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537)
    at hudson.model.Run.execute(Run.java:1741)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:408)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessImpl.create(Native Method)
    at java.lang.ProcessImpl.(Unknown Source)
    at java.lang.ProcessImpl.start(Unknown Source)
    at java.lang.ProcessBuilder.start(Unknown Source)
    at hudson.Proc$LocalProc.(Proc.java:244)
    at hudson.Proc$LocalProc.(Proc.java:216)
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:816)
    at hudson.Launcher$ProcStarter.start(Launcher.java:382)
    at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1149)
    at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1114)
    at hudson.remoting.UserRequest.perform(UserRequest.java:120)
    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    at hudson.remoting.Request$2.run(Request.java:326)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at hudson.remoting.Engine$1$1.run(Engine.java:62)
    at java.lang.Thread.run(Unknown Source)
Build step 'Windows PowerShell' marked build as failure
Finished: FAILURE

共有1个答案

尤钱明
2023-03-14

我不确定这是否会对其他人有所帮助,但我会把它写下来,为子孙后代服务。确保您的奴隶正在运行和连接。当我的Windows Jenkins从机断开连接时,我看到了这个错误,但我没有设置“限制该构建可以在哪里运行”,所以它在我的主机(Linux机器)上运行。显然,它在那里找不到PowerShell.exe。:d

 类似资料:
  • 目前,我正在尝试使用Jenkins来部署我的项目代码。在这个项目中,我们使用Junit来实现TDD方法。 最后一个错误是在执行这行时发生了以下错误:也是在build.xml中,当构建一个模块(SDK)时 在成功构建之后,我想为各种测试套件生成Junit-report。Junit测试报告xmls现在正在为每个模块生成。

  • sonar.projectkey=projkey sonar.projectname=projname Sonar.ProjectVersion=1.0 sonar.sources={path} sonar.java.binaries={path} Sonar.ProjectBaseDir={path}

  • 我已经在windows上安装了Jenkins版本并使用配置了并且能够通过选中选项从签出。但取消选中此选项后,在运行构建时会出现以下错误: cvs rlog-s-d06 Mar2015 18:49:11+0500<09 Mar2015 14:54:14+0500 ns cvs[rlog中止]:/home/cvs/src/ns/stencils/statements/attic/checktempla

  • 我试图使用Jenkins CLI安装Jenkins插件,但收到了一个错误。 插件安装命令: java-jar-jenkins cli。jar-s http:// 错误: 我尝试过的: 改变java版本,现在我已经尝试了Java8和Java11 重新下载jenkins CLI以确保其未损坏 从Jenkins界面安装一个类似的插件,这一点很成功 其他Jenkins CLI命令(如列表插件)也能成功运行

  • 嗨,当我试图在OpenSatck上提供一个从服务器时,我得到了一个follwing错误。在openstack上创建了从机,但它会破坏它,出现以下异常 在sun.reflect.nativeMethodAccessorImpl.Invoke0(原生方法)在sun.reflect.nativeMethodAccessorImpl.Invoke(未知源)在java.lang.reflect.Method

  • 詹金斯设置 我不使用任何源代码管理方法,因此我将其保留为非 在全局工具配置下 > JDK安装已设置为自动安装 Maven配置设置为, > 文件路径=C:\Users***。m2\设置。xml 默认全局设置提供程序=使用默认maven全局设置 TestNg文件 POM文件