jenkins - Jenkins 的 Artifactory 插件 - 脚本化管道中的 NPM 安装失败
问题描述
我想为我的 NPM 项目的 Jenkins Scripted Pipeline 使用 Artifactory 插件。在 NPM 安装期间,我遇到了一个问题:
SEVERE: process hasn't exited
java.lang.IllegalThreadStateException: process hasn't exited
at java.lang.UNIXProcess.exitValue(UNIXProcess.java:423)
at org.jfrog.build.extractor.executor.CommandExecutor.exeCommand(CommandExecutor.java:78)
at org.jfrog.build.extractor.npm.NpmDriver.runCommand(NpmDriver.java:80)
at org.jfrog.build.extractor.npm.NpmDriver.install(NpmDriver.java:42)
at org.jfrog.build.extractor.npm.extractor.NpmBuildInfoExtractor.runInstall(NpmBuildInfoExtractor.java:153)
at org.jfrog.build.extractor.npm.extractor.NpmBuildInfoExtractor.extract(NpmBuildInfoExtractor.java:61)
at org.jfrog.build.extractor.npm.extractor.NpmInstall.execute(NpmInstall.java:50)
at org.jfrog.hudson.npm.NpmInstallCallable.invoke(NpmInstallCallable.java:53)
at org.jfrog.hudson.npm.NpmInstallCallable.invoke(NpmInstallCallable.java:20)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3085)
at hudson.remoting.UserRequest.perform(UserRequest.java:212)
at hudson.remoting.UserRequest.perform(UserRequest.java:54)
at hudson.remoting.Request$2.run(Request.java:369)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
我在 Jenkins 的 Scripted Pipeline 中使用 Jenkins 的Artifactory 插件(v. 3.2.2) 。我正在关注官方 Jfrog 文档。
我已经以某种方式与 JFrog 支持保持联系,我已经在官方 Github中提出了一个问题,并在此处为 JFrog 支持提供了问题。
我已经将这个插件用于 maven Project 的脚本化管道,它工作正常。当我从package.json删除一些依赖项时,我试图调试这个问题很多,有时它会起作用。
这是我的 groovy 脚本中的配置。
def server = Artifactory.server 'artifacts-prod-01'
server.credentialsId = 'artifactory-credentials-id'
def rtNpm = Artifactory.newNpmBuild()
rtNpm.resolver server: server, repo: 'npm-main-dev'
withEnv(["PATH+NODEJS=${tool 'NodeJS 10'}/bin"]) {
def buildInfo = rtNpm.install path: '.'
}
我希望已经安装了package.json中指定的所有包,但似乎在 npm install 期间有一个超时。我只有一个有趣的观点。我尝试在此处安装具有固定超时的快照版本,并在此处进行以下修复,然后出现此错误:
[Bitbucket] Notifying commit build result
[Bitbucket] Build result notified
java.io.IOException: Unexpected EOF
at hudson.remoting.ChunkedInputStream.readUntilBreak(ChunkedInputStream.java:99)
at hudson.remoting.ChunkedCommandTransport.readBlock(ChunkedCommandTransport.java:39)
at hudson.remoting.AbstractSynchronousByteArrayCommandTransport.read(AbstractSynchronousByteArrayCommandTransport.java:35)
at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:63)
Also: hudson.remoting.Channel$CallSiteStackTrace: Remote call to stg-default-agent-eu
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1741)
at hudson.remoting.Request.call(Request.java:202)
at hudson.remoting.Channel.call(Channel.java:954)
at hudson.FilePath.act(FilePath.java:1071)
at hudson.FilePath.act(FilePath.java:1060)
at org.jfrog.hudson.pipeline.common.executors.NpmInstallExecutor.execute(NpmInstallExecutor.java:57)
at org.jfrog.hudson.pipeline.scripted.steps.NpmInstallStep$Execution.run(NpmInstallStep.java:64)
at org.jfrog.hudson.pipeline.scripted.steps.NpmInstallStep$Execution.run(NpmInstallStep.java:39)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
at hudson.security.ACL.impersonate(ACL.java:290)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused: hudson.remoting.RequestAbortedException
at hudson.remoting.Request.abort(Request.java:340)
at hudson.remoting.Channel.terminate(Channel.java:1038)
at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:96)
Finished: FAILURE
有没有人使用 Artifactory Jenkins 插件通过脚本管道构建他们的 NPM 项目?如果是的话,你能分享你的配置吗?非常感谢。
解决方案
推荐阅读
- python - 如何获取特定数据框行的列值
- sql - 加入子表中的前 n 条记录
- dataweave - 如何跨有效负载获取 sizeOf() 数组
- maven - maven:从属性文件中读取 sonar.login
- mysql - mysql命令在旧行之间插入新行
- vba - 使用 DataObject.PutInClipboard 后粘贴返回未知字符
- python - 按下按钮时打破无限循环
- python - 从 EMR spark 连接到 EMR presto - 连接失败
- react-native - 在 "Connect(Login)" 的上下文中找不到 "store" ,我找不到解决方案这是我的代码
- html - 如何在移动视图的顶栏上将此按钮居中