我正在使用jenkins主从模型在kubernetes中构建一个项目(使用helm安装),这是我用来编译java项目的简单构建脚本:
#!/usr/bin/env bash
set -u
set -e
set -x
./gradlew clean :eureka-service:build -x test
当我在jenkins从节点中执行此构建脚本时,显示错误:
Started by user admin
Running as SYSTEM
Agent default-j0463 is provisioned from template default
---
apiVersion: "v1"
kind: "Pod"
metadata:
labels:
jenkins/jenkins-jenkins-slave: "true"
jenkins/label: "jenkins-jenkins-slavex"
name: "default-j0463"
spec:
containers:
- args:
- "********"
- "default-j0463"
env:
- name: "JENKINS_SECRET"
value: "********"
- name: "JENKINS_TUNNEL"
value: "jenkins-agent:50000"
- name: "JENKINS_AGENT_NAME"
value: "default-j0463"
- name: "JENKINS_NAME"
value: "default-j0463"
- name: "JENKINS_AGENT_WORKDIR"
value: "/home/jenkins"
- name: "JENKINS_URL"
value: "http://jenkins.infrastructure.svc.cluster.local:8080"
image: "jenkins/jnlp-slave:3.27-1"
imagePullPolicy: "IfNotPresent"
name: "jnlp"
resources:
limits:
memory: "512Mi"
cpu: "512m"
requests:
memory: "512Mi"
cpu: "512m"
tty: false
volumeMounts:
- mountPath: "/home/jenkins"
name: "workspace-volume"
readOnly: false
workingDir: "/home/jenkins"
nodeSelector:
kubernetes.io/os: "linux"
restartPolicy: "Never"
serviceAccount: "default"
volumes:
- emptyDir:
medium: ""
name: "workspace-volume"
Building remotely on default-j0463 (jenkins-jenkins-slave) in workspace /home/jenkins/workspace/eureka-service
Installer "Extract *.zip/*.tar.gz" cannot be used to install "jdk11" on the node "default-j0463"
No credentials specified
Installer "Extract *.zip/*.tar.gz" cannot be used to install "jdk11" on the node "default-j0463"
Cloning the remote Git repository
Cloning repository https://github.com/jiangxiaoqiang/retire.git
> git init /home/jenkins/workspace/eureka-service # timeout=10
Fetching upstream changes from https://github.com/jiangxiaoqiang/retire.git
> git --version # timeout=10
> git --version # 'git version 2.11.0'
> git fetch --tags --progress -- https://github.com/jiangxiaoqiang/retire.git +refs/heads/*:refs/remotes/origin/* # timeout=10
> git config remote.origin.url https://github.com/jiangxiaoqiang/retire.git # timeout=10
> git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
> git config remote.origin.url https://github.com/jiangxiaoqiang/retire.git # timeout=10
Fetching upstream changes from https://github.com/jiangxiaoqiang/retire.git
> git fetch --tags --progress -- https://github.com/jiangxiaoqiang/retire.git +refs/heads/*:refs/remotes/origin/* # timeout=10
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Installer "Extract *.zip/*.tar.gz" cannot be used to install "jdk11" on the node "default-j0463"
Checking out Revision 370d36c72460362fad2d21135d68963b3ec8ff75 (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f 370d36c72460362fad2d21135d68963b3ec8ff75 # timeout=10
Commit message: "[feature] tweak"
> git rev-list --no-walk 370d36c72460362fad2d21135d68963b3ec8ff75 # timeout=10
Installer "Extract *.zip/*.tar.gz" cannot be used to install "jdk11" on the node "default-j0463"
[eureka-service] $ /bin/sh -xe /tmp/jenkins4274366632085338330.sh
+ cd /home/jenkins/workspace/eureka-service/eureka-service
+ ./script/docker-deploy-impl.sh
+ ./gradlew clean :eureka-service:build -x test
Downloading https://services.gradle.org/distributions/gradle-6.5.1-bin.zip
.........10%..........20%..........30%..........40%.........50%..........60%..........70%..........80%.........90%..........100%
Welcome to Gradle 6.5.1!
Here are the highlights of this release:
- Experimental file-system watching
- Improved version ordering
- New samples
For more details see https://docs.gradle.org/6.5.1/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
FATAL: command execution failed
java.nio.channels.ClosedChannelException
at org.jenkinsci.remoting.protocol.NetworkLayer.onRecvClosed(NetworkLayer.java:154)
at org.jenkinsci.remoting.protocol.impl.NIONetworkLayer.ready(NIONetworkLayer.java:142)
at org.jenkinsci.remoting.protocol.IOHub$OnReady.run(IOHub.java:795)
at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
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: java.io.IOException: Backing channel 'JNLP4-connect connection from 10.11.125.137/10.11.125.137:45922' is disconnected.
at hudson.remoting.RemoteInvocationHandler.channelOrFail(RemoteInvocationHandler.java:216)
at hudson.remoting.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:285)
at com.sun.proxy.$Proxy89.isAlive(Unknown Source)
at hudson.Launcher$RemoteLauncher$ProcImpl.isAlive(Launcher.java:1147)
at hudson.Launcher$RemoteLauncher$ProcImpl.join(Launcher.java:1139)
at hudson.tasks.CommandInterpreter.join(CommandInterpreter.java:155)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:109)
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:741)
at hudson.model.Build$BuildExecution.build(Build.java:206)
at hudson.model.Build$BuildExecution.doRun(Build.java:163)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
at hudson.model.Run.execute(Run.java:1880)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:428)
FATAL: Unable to delete script file /tmp/jenkins4274366632085338330.sh
java.nio.channels.ClosedChannelException
at org.jenkinsci.remoting.protocol.NetworkLayer.onRecvClosed(NetworkLayer.java:154)
at org.jenkinsci.remoting.protocol.impl.NIONetworkLayer.ready(NIONetworkLayer.java:142)
at org.jenkinsci.remoting.protocol.IOHub$OnReady.run(IOHub.java:795)
at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
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.ChannelClosedException: Channel "hudson.remoting.Channel@52ebddbf:JNLP4-connect connection from 10.11.125.137/10.11.125.137:45922": Remote call on JNLP4-connect connection from 10.11.125.137/10.11.125.137:45922 failed. The channel is closing down or has closed down
at hudson.remoting.Channel.call(Channel.java:991)
at hudson.FilePath.act(FilePath.java:1069)
at hudson.FilePath.act(FilePath.java:1058)
at hudson.FilePath.delete(FilePath.java:1543)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:123)
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:741)
at hudson.model.Build$BuildExecution.build(Build.java:206)
at hudson.model.Build$BuildExecution.doRun(Build.java:163)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
at hudson.model.Run.execute(Run.java:1880)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:428)
Build step 'Execute shell' marked build as failure
FATAL: Channel "hudson.remoting.Channel@52ebddbf:JNLP4-connect connection from 10.11.125.137/10.11.125.137:45922": Remote call on JNLP4-connect connection from 10.11.125.137/10.11.125.137:45922 failed. The channel is closing down or has closed down
java.nio.channels.ClosedChannelException
at org.jenkinsci.remoting.protocol.NetworkLayer.onRecvClosed(NetworkLayer.java:154)
at org.jenkinsci.remoting.protocol.impl.NIONetworkLayer.ready(NIONetworkLayer.java:142)
at org.jenkinsci.remoting.protocol.IOHub$OnReady.run(IOHub.java:795)
at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
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.ChannelClosedException: Channel "hudson.remoting.Channel@52ebddbf:JNLP4-connect connection from 10.11.125.137/10.11.125.137:45922": Remote call on JNLP4-connect connection from 10.11.125.137/10.11.125.137:45922 failed. The channel is closing down or has closed down
at hudson.remoting.Channel.call(Channel.java:991)
at hudson.Launcher$RemoteLauncher.kill(Launcher.java:1083)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:510)
at hudson.model.Run.execute(Run.java:1880)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:428)
Finished: FAILURE
我已经在尝试测试命令,并显示and模板连接成功。我正在尝试将and模板内存增加到512MB,该项目很小,并且只有很少的code.where是问题所在,我应该怎么解决?
发布于 2020-08-15 23:55:17
我最终发现是资源不足以构建。因此我调整了配置,并将模板pod资源从512Mi增加到1024Mi:
* Request Memory:1024Mi
* Limit Memory:1024Mi
很管用。
https://stackoverflow.com/questions/63415061
复制相似问题