完整日志
`Started by user project-regular
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] node
Agent maven-6g389 is provisioned from template maven
apiVersion: “v1”
kind: “Pod”
metadata:
annotations: {}
labels:
jenkins: “slave”
jenkins/label-digest: “f02c587acd12db3d7b4a28edb5c2eae5f526ce28”
jenkins/label: “maven”
name: “maven-6g389”
spec:
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- preference:
matchExpressions:
- key: “node-role.kubernetes.io/worker”
operator: “In”
values:
- “ci”
weight: 1
containers:
- args:
- “********”
- “maven-6g389”
command:
- “jenkins-slave”
env:
- name: “JENKINS_SECRET”
value: “********”
- name: “JENKINS_TUNNEL”
value: “ks-jenkins-agent.kubesphere-devops-system:50000”
- name: “JENKINS_AGENT_NAME”
value: “maven-6g389”
- name: “JENKINS_NAME”
value: “maven-6g389”
- name: “JENKINS_AGENT_WORKDIR”
value: “/home/jenkins/agent”
- name: “JENKINS_URL”
value: “http://ks-jenkins.kubesphere-devops-system:80/”
image: “registry.cn-beijing.aliyuncs.com/kubesphereio/jnlp-slave:3.27-1”
imagePullPolicy: “IfNotPresent”
name: “jnlp”
resources:
limits:
memory: “1536Mi”
requests:
memory: “400Mi”
cpu: “50m”
tty: false
volumeMounts:
- mountPath: “/root/.sonar/cache”
name: “volume-2”
readOnly: false
- mountPath: “/root/.m2”
name: “volume-1”
readOnly: false
- mountPath: “/var/run/docker.sock”
name: “volume-0”
readOnly: false
- mountPath: “/home/jenkins/agent”
name: “workspace-volume”
readOnly: false
- command:
- “cat”
image: “registry.cn-beijing.aliyuncs.com/kubesphereio/builder-maven:v3.1.0”
imagePullPolicy: “IfNotPresent”
name: “maven”
resources:
limits:
ephemeral-storage: “10Gi”
memory: “8192Mi”
cpu: “4000m”
requests:
ephemeral-storage: “1Gi”
memory: “100Mi”
cpu: “100m”
tty: true
volumeMounts:
- mountPath: “/opt/apache-maven-3.5.3/conf/settings.xml”
name: “config-volume”
subPath: “settings.xml”
- mountPath: “/root/.sonar/cache”
name: “volume-2”
readOnly: false
- mountPath: “/root/.m2”
name: “volume-1”
readOnly: false
- mountPath: “/var/run/docker.sock”
name: “volume-0”
readOnly: false
- mountPath: “/home/jenkins/agent”
name: “workspace-volume”
readOnly: false
workingDir: “/home/jenkins/agent”
nodeSelector: {}
restartPolicy: “Never”
securityContext:
fsGroup: 1000
tolerations:
- effect: “NoSchedule”
key: “node.kubernetes.io/ci”
operator: “Exists”
- effect: “PreferNoSchedule”
key: “node.kubernetes.io/ci”
operator: “Exists”
volumes:
- hostPath:
path: “/var/run/docker.sock”
name: “volume-0”
- hostPath:
path: “/var/data/jenkins_sonar_cache”
name: “volume-2”
- hostPath:
path: “/var/data/jenkins_maven_cache”
name: “volume-1”
- emptyDir:
medium: ""
name: “workspace-volume”
- configMap:
items:
- key: “MavenSetting”
path: “settings.xml”
name: “ks-devops-agent”
name: “config-volume”
Running on maven-6g389 in /home/jenkins/agent/workspace/demo-devops4wbgp/demo-pipeline
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Checkout SCM)
[Pipeline] git
The recommended git tool is: NONE
No credentials specified
Cloning the remote Git repository
Cloning repository https://gitee.com/lesterhnu/devops-java-sample.git
git init /home/jenkins/agent/workspace/demo-devops4wbgp/demo-pipeline # timeout=10
Fetching upstream changes from https://gitee.com/lesterhnu/devops-java-sample.git
git –version # timeout=10
git –version # ‘git version 2.11.0’
git fetch –tags –progress – https://gitee.com/lesterhnu/devops-java-sample.git +refs/heads/:refs/remotes/origin/ # timeout=10
Avoid second fetch
Checking out Revision 1ca7eff040398a450ace87a3ebc0c280f1b5a778 (refs/remotes/origin/sonarqube)
git config remote.origin.url https://gitee.com/lesterhnu/devops-java-sample.git # timeout=10
git config –add remote.origin.fetch +refs/heads/:refs/remotes/origin/ # timeout=10
git rev-parse refs/remotes/origin/sonarqube^{commit} # timeout=10
git config core.sparsecheckout # timeout=10
git checkout -f 1ca7eff040398a450ace87a3ebc0c280f1b5a778 # timeout=10
git branch -a -v –no-abbrev # timeout=10
git checkout -b sonarqube 1ca7eff040398a450ace87a3ebc0c280f1b5a778 # timeout=10
Commit message: “update deploy/no-branch-dev/devops-sample.yaml.”
git rev-list –no-walk 195039afc31e7429f2b34331eb6b083720f5d1da # timeout=10
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Unit Test)
[Pipeline] container
[Pipeline] {
[Pipeline] sh
++ pwd
- mvn clean -o -gs /home/jenkins/agent/workspace/demo-devops4wbgp/demo-pipeline/configuration/settings.xml test
[INFO] Scanning for projects…
[INFO]
[INFO] —————–< io.kubesphere.devops:devops-sample >—————–
[INFO] Building devops-sample :: HelloWorld Demo 0.0.1-SNAPSHOT
[INFO] ——————————–[ jar ]———————————
[INFO]
[INFO] — maven-clean-plugin:2.6.1:clean (default-clean) @ devops-sample —
[INFO]
[INFO] — jacoco-maven-plugin:0.8.2:prepare-agent (agent-for-ut) @ devops-sample —
[INFO] argLine set to -javaagent:/home/jenkins/agent/workspace/demo-devops4wbgp/demo-pipeline/artifacts/m2/org/jacoco/org.jacoco.agent/0.8.2/org.jacoco.agent-0.8.2-runtime.jar=destfile=/home/jenkins/agent/workspace/demo-devops4wbgp/demo-pipeline/target/jacoco.exec,append=true
[INFO]
[INFO] — maven-resources-plugin:2.6:resources (default-resources) @ devops-sample —
[INFO] Using ‘UTF-8’ encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/jenkins/agent/workspace/demo-devops4wbgp/demo-pipeline/src/main/resources
[INFO] skip non existing resourceDirectory /home/jenkins/agent/workspace/demo-devops4wbgp/demo-pipeline/src/main/resources
[INFO]
[INFO] — maven-compiler-plugin:3.1:compile (default-compile) @ devops-sample —
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /home/jenkins/agent/workspace/demo-devops4wbgp/demo-pipeline/target/classes
[INFO]
[INFO] — maven-resources-plugin:2.6:testResources (default-testResources) @ devops-sample —
[INFO] Using ‘UTF-8’ encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/jenkins/agent/workspace/demo-devops4wbgp/demo-pipeline/src/test/resources
[INFO]
[INFO] — maven-compiler-plugin:3.1:testCompile (default-testCompile) @ devops-sample —
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /home/jenkins/agent/workspace/demo-devops4wbgp/demo-pipeline/target/test-classes
[INFO]
[INFO] — maven-surefire-plugin:2.18.1:test (default-test) @ devops-sample —
[INFO] Surefire report directory: /home/jenkins/agent/workspace/demo-devops4wbgp/demo-pipeline/target/surefire-reports
T E S T S
Running io.kubesphere.devops.HelloWorldControllerTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.009 sec - in io.kubesphere.devops.HelloWorldControllerTest
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] ————————————————————————
[INFO] BUILD SUCCESS
[INFO] ————————————————————————
[INFO] Total time: 6.169 s
[INFO] Finished at: 2021-08-10T03:11:49Z
[INFO] ————————————————————————
[Pipeline] }
[Pipeline] // container
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Build and Push)
[Pipeline] container
[Pipeline] {
[Pipeline] sh
++ pwd
- mvn -o -Dmaven.test.skip=true -gs /home/jenkins/agent/workspace/demo-devops4wbgp/demo-pipeline/configuration/settings.xml clean package
[INFO] Scanning for projects…
[INFO]
[INFO] —————–< io.kubesphere.devops:devops-sample >—————–
[INFO] Building devops-sample :: HelloWorld Demo 0.0.1-SNAPSHOT
[INFO] ——————————–[ jar ]———————————
[INFO]
[INFO] — maven-clean-plugin:2.6.1:clean (default-clean) @ devops-sample —
[INFO] Deleting /home/jenkins/agent/workspace/demo-devops4wbgp/demo-pipeline/target
[INFO]
[INFO] — jacoco-maven-plugin:0.8.2:prepare-agent (agent-for-ut) @ devops-sample —
[INFO] argLine set to -javaagent:/home/jenkins/agent/workspace/demo-devops4wbgp/demo-pipeline/artifacts/m2/org/jacoco/org.jacoco.agent/0.8.2/org.jacoco.agent-0.8.2-runtime.jar=destfile=/home/jenkins/agent/workspace/demo-devops4wbgp/demo-pipeline/target/jacoco.exec,append=true
[INFO]
[INFO] — maven-resources-plugin:2.6:resources (default-resources) @ devops-sample —
[INFO] Using ‘UTF-8’ encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/jenkins/agent/workspace/demo-devops4wbgp/demo-pipeline/src/main/resources
[INFO] skip non existing resourceDirectory /home/jenkins/agent/workspace/demo-devops4wbgp/demo-pipeline/src/main/resources
[INFO]
[INFO] — maven-compiler-plugin:3.1:compile (default-compile) @ devops-sample —
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /home/jenkins/agent/workspace/demo-devops4wbgp/demo-pipeline/target/classes
[INFO]
[INFO] — maven-resources-plugin:2.6:testResources (default-testResources) @ devops-sample —
[INFO] Not copying test resources
[INFO]
[INFO] — maven-compiler-plugin:3.1:testCompile (default-testCompile) @ devops-sample —
[INFO] Not compiling test sources
[INFO]
[INFO] — maven-surefire-plugin:2.18.1:test (default-test) @ devops-sample —
[INFO] Tests are skipped.
[INFO]
[INFO] — maven-jar-plugin:2.6:jar (default-jar) @ devops-sample —
[INFO] Building jar: /home/jenkins/agent/workspace/demo-devops4wbgp/demo-pipeline/target/devops-sample-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] — spring-boot-maven-plugin:1.4.1.BUILD-SNAPSHOT:repackage (default) @ devops-sample —
[INFO] ————————————————————————
[INFO] BUILD SUCCESS
[INFO] ————————————————————————
[INFO] Total time: 4.613 s
[INFO] Finished at: 2021-08-10T03:11:56Z
[INFO] ————————————————————————
[Pipeline] sh
- docker build -f Dockerfile-online -t docker.io/lesterhnu/devops-sample:SNAPSHOT-34 .
Sending build context to Docker daemon 146MB
Step ¼ : FROM java:openjdk-8-jre-alpine
—> fdc893b19a14
Step 2/4 : WORKDIR /home
—> Using cache
—> 9d8c88f491d5
Step ¾ : COPY target/*.jar /home
—> 5f296f16b201
Step 4/4 : ENTRYPOINT java -jar *.jar
—> Running in 2a64f3b97172
Removing intermediate container 2a64f3b97172
—> 03883cea6db2
Successfully built 03883cea6db2
Successfully tagged lesterhnu/devops-sample:SNAPSHOT-34
[Pipeline] withCredentials
Masking supported pattern matches of $DOCKER_USERNAME or $DOCKER_PASSWORD
[Pipeline] {
[Pipeline] sh
Login Succeeded
[Pipeline] sh
- docker push docker.io/*/devops-sample:SNAPSHOT-34
The push refers to repository [docker.io/*/devops-sample]
9f5d6253ff6b: Preparing
20dd87a4c2ab: Preparing
78075328e0da: Preparing
9f8566ee5135: Preparing
9f8566ee5135: Layer already exists
78075328e0da: Layer already exists
20dd87a4c2ab: Layer already exists
9f5d6253ff6b: Pushed
SNAPSHOT-34: digest: sha256:154158ac457623654aca72b484e9b1f4b03e2d229f8b506781d76561fb9925ac size: 1159
[Pipeline] }
[Pipeline] // withCredentials
[Pipeline] }
[Pipeline] // container
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Artifacts)
[Pipeline] archiveArtifacts
Archiving artifacts
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (查看环境)
[Pipeline] sh
- pwd
- echo 当前目录 /home/jenkins/agent/workspace/demo-devops4wbgp/demo-pipeline
当前目录 /home/jenkins/agent/workspace/demo-devops4wbgp/demo-pipeline
- hostname
- echo maven-6g389
maven-6g389
- cat /etc/hosts
Kubernetes-managed hosts file.
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
fe00::0 ip6-mcastprefix
fe00::1 ip6-allnodes
fe00::2 ip6-allrouters
10.233.91.70 maven-6g389
- cat /etc/resolv.conf
nameserver 169.254.25.10
search kubesphere-devops-system.svc.cluster.local svc.cluster.local cluster.local localhost
options ndots:5
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Deploy to Dev)
[Pipeline] kubernetesDeploy
Starting Kubernetes deployment
Loading configuration: /home/jenkins/agent/workspace/demo-devops4wbgp/demo-pipeline/deploy/no-branch-dev/devops-sample-svc.yaml
ERROR: ERROR: java.lang.RuntimeException: io.kubernetes.client.openapi.ApiException: java.net.UnknownHostException: lb.kubesphere.local: Name or service not known
hudson.remoting.ProxyException: java.lang.RuntimeException: io.kubernetes.client.openapi.ApiException: java.net.UnknownHostException: lb.kubesphere.local: Name or service not known
at com.microsoft.jenkins.kubernetes.wrapper.ResourceManager.handleApiExceptionExceptNotFound(ResourceManager.java:180)
at com.microsoft.jenkins.kubernetes.wrapper.V1ResourceManager$ServiceUpdater.getCurrentResource(V1ResourceManager.java:391)
at com.microsoft.jenkins.kubernetes.wrapper.V1ResourceManager$ServiceUpdater.getCurrentResource(V1ResourceManager.java:379)
at com.microsoft.jenkins.kubernetes.wrapper.ResourceManager$ResourceUpdater.createOrApply(ResourceManager.java:93)
at com.microsoft.jenkins.kubernetes.wrapper.KubernetesClientWrapper.handleResource(KubernetesClientWrapper.java:289)
at com.microsoft.jenkins.kubernetes.wrapper.KubernetesClientWrapper.apply(KubernetesClientWrapper.java:256)
at com.microsoft.jenkins.kubernetes.command.DeploymentCommand$DeploymentTask.doCall(DeploymentCommand.java:172)
at com.microsoft.jenkins.kubernetes.command.DeploymentCommand$DeploymentTask.call(DeploymentCommand.java:124)
at com.microsoft.jenkins.kubernetes.command.DeploymentCommand$DeploymentTask.call(DeploymentCommand.java:106)
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 hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:93)
at java.lang.Thread.run(Thread.java:748)
Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from 10.233.91.70/10.233.91.70:53944
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1800)
at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357)
at hudson.remoting.Channel.call(Channel.java:1001)
at hudson.FilePath.act(FilePath.java:1160)
at com.microsoft.jenkins.kubernetes.command.DeploymentCommand.execute(DeploymentCommand.java:68)
at com.microsoft.jenkins.kubernetes.command.DeploymentCommand.execute(DeploymentCommand.java:45)
at com.microsoft.jenkins.azurecommons.command.CommandService.runCommand(CommandService.java:88)
at com.microsoft.jenkins.azurecommons.command.CommandService.execute(CommandService.java:96)
at com.microsoft.jenkins.azurecommons.command.CommandService.executeCommands(CommandService.java:75)
at com.microsoft.jenkins.azurecommons.command.BaseCommandContext.executeCommands(BaseCommandContext.java:77)
at com.microsoft.jenkins.kubernetes.KubernetesDeploy.perform(KubernetesDeploy.java:42)
at com.microsoft.jenkins.azurecommons.command.SimpleBuildStepExecution.run(SimpleBuildStepExecution.java:54)
at com.microsoft.jenkins.azurecommons.command.SimpleBuildStepExecution.run(SimpleBuildStepExecution.java:35)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
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)
… 1 more
Caused by: hudson.remoting.ProxyException: io.kubernetes.client.openapi.ApiException: java.net.UnknownHostException: lb.kubesphere.local: Name or service not known
at io.kubernetes.client.openapi.ApiClient.execute(ApiClient.java:898)
at io.kubernetes.client.openapi.apis.CoreV1Api.readNamespacedServiceWithHttpInfo(CoreV1Api.java:26889)
at io.kubernetes.client.openapi.apis.CoreV1Api.readNamespacedService(CoreV1Api.java:26865)
at com.microsoft.jenkins.kubernetes.wrapper.V1ResourceManager$ServiceUpdater.getCurrentResource(V1ResourceManager.java:388)
… 16 more
Caused by: hudson.remoting.ProxyException: java.net.UnknownHostException: lb.kubesphere.local: Name or service not known
at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:929)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1324)
at java.net.InetAddress.getAllByName0(InetAddress.java:1277)
at java.net.InetAddress.getAllByName(InetAddress.java:1193)
at java.net.InetAddress.getAllByName(InetAddress.java:1127)
at okhttp3.Dns.lambda$static$0(Dns.java:39)
at okhttp3.internal.connection.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:171)
at okhttp3.internal.connection.RouteSelector.nextProxy(RouteSelector.java:135)
at okhttp3.internal.connection.RouteSelector.next(RouteSelector.java:84)
at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.java:187)
at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.java:108)
at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.java:88)
at okhttp3.internal.connection.Transmitter.newExchange(Transmitter.java:169)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:41)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:94)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:88)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:221)
at okhttp3.RealCall.execute(RealCall.java:81)
at io.kubernetes.client.openapi.ApiClient.execute(ApiClient.java:894)
… 19 more
Api call failed with code 0, detailed message: null
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: Kubernetes deployment ended with HasError
Finished: FAILURE
`