版本:dev-2.1
按照https://kubesphere.io/docs/v2.1/zh-CN/quick-start/harbor-gitlab-devops-offline/ 文档操作
流水线sonar环节报错截图如下

流水线详细日志如下
Started by user admin
Replayed #1
git rev-parse –is-inside-work-tree # timeout=10
Setting origin to http://git.hrlyit.com/chenxiaomin/devops-java-sample.git
git config remote.origin.url http://git.hrlyit.com/chenxiaomin/devops-java-sample.git # timeout=10
Fetching origin…
Fetching upstream changes from origin
git –version # timeout=10
git config –get remote.origin.url # timeout=10
using GIT_ASKPASS to set credentials
git fetch –tags –progress origin +refs/heads/:refs/remotes/origin/
Seen branch in repository origin/master
Seen 1 remote branch
Obtained Jenkinsfile-on-prem from b39cf360c6d7c6019518ef015b4576d43a478726
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] node
Agent maven-1cqgx is provisioned from template Kubernetes Pod Template
apiVersion: “v1″
kind: “Pod”
metadata:
annotations: {}
labels:
jenkins: “slave”
jenkins/maven: “true”
name: “maven-1cqgx”
spec:
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- preference:
matchExpressions:
- key: “node-role.kubernetes.io/worker”
operator: “In”
values:
- “ci”
weight: 1
containers:
- args:
- “********”
- “maven-1cqgx”
env:
- name: “JENKINS_SECRET”
value: “********”
- name: “JENKINS_TUNNEL”
value: “ks-jenkins-agent.kubesphere-devops-system:50000″
- name: “JENKINS_AGENT_NAME”
value: “maven-1cqgx”
- name: “JENKINS_NAME”
value: “maven-1cqgx”
- name: “JENKINS_AGENT_WORKDIR”
value: “/home/jenkins/agent”
- name: “JENKINS_URL”
value: “http://ks-jenkins.kubesphere-devops-system:80/”
image: “jenkins/jnlp-slave:3.27-1″
imagePullPolicy: “IfNotPresent”
name: “jnlp”
resources:
limits:
memory: “1536Mi”
requests:
memory: “400Mi”
cpu: “50m”
securityContext:
privileged: false
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: “kubespheredev/builder-maven:advanced-2.1.0-dev”
imagePullPolicy: “IfNotPresent”
name: “maven”
resources:
limits:
ephemeral-storage: “10Gi”
memory: “8192Mi”
cpu: “4000m”
requests:
ephemeral-storage: “1Gi”
memory: “100Mi”
cpu: “100m”
securityContext:
privileged: false
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: “sonar_cache”
name: “volume-2”
- hostPath:
path: “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-1cqgx in /home/jenkins/agent/workspace/ct-ggRXjnY2MQ8l_java-demo_master
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Declarative: Checkout SCM)
[Pipeline] checkout
using credential gitlab-id
Fetching changes from the remote Git repository
Checking out Revision 4e7475f4608e4c3e266a84e5735edae98a29e2f7 (master)
Commit message: “Update Jenkinsfile-on-prem”
git rev-parse –is-inside-work-tree # timeout=10
git config remote.origin.url http://git.hrlyit.com/chenxiaomin/devops-java-sample.git # timeout=10
Fetching upstream changes from http://git.hrlyit.com/chenxiaomin/devops-java-sample.git
git –version # timeout=10
using GIT_ASKPASS to set credentials
git fetch –tags –progress http://git.hrlyit.com/chenxiaomin/devops-java-sample.git +refs/heads/:refs/remotes/origin/ –depth=1 # timeout=20
git config core.sparsecheckout # timeout=10
git checkout -f 4e7475f4608e4c3e266a84e5735edae98a29e2f7
git rev-list –no-walk 4e7475f4608e4c3e266a84e5735edae98a29e2f7 # timeout=10
[Pipeline] }
[Pipeline] // stage
[Pipeline] withEnv
[Pipeline] {
[Pipeline] withEnv
[Pipeline] {
[Pipeline] stage
[Pipeline] { (checkout scm)
[Pipeline] checkout
using credential gitlab-id
Fetching changes from the remote Git repository
Checking out Revision 4e7475f4608e4c3e266a84e5735edae98a29e2f7 (master)
Commit message: “Update Jenkinsfile-on-prem”
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (unit test)
[Pipeline] container
[Pipeline] {
[Pipeline] sh
git rev-parse –is-inside-work-tree # timeout=10
git config remote.origin.url http://git.hrlyit.com/chenxiaomin/devops-java-sample.git # timeout=10
Fetching upstream changes from http://git.hrlyit.com/chenxiaomin/devops-java-sample.git
git –version # timeout=10
using GIT_ASKPASS to set credentials
git fetch –tags –progress http://git.hrlyit.com/chenxiaomin/devops-java-sample.git +refs/heads/:refs/remotes/origin/ –depth=1 # timeout=20
git config core.sparsecheckout # timeout=10
git checkout -f 4e7475f4608e4c3e266a84e5735edae98a29e2f7
++ pwd
- mvn clean -o -gs /home/jenkins/agent/workspace/ct-ggRXjnY2MQ8l_java-demo_master/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] Deleting /home/jenkins/agent/workspace/ct-ggRXjnY2MQ8l_java-demo_master/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/ct-ggRXjnY2MQ8l_java-demo_master/artifacts/m2/org/jacoco/org.jacoco.agent/0.8.2/org.jacoco.agent-0.8.2-runtime.jar=destfile=/home/jenkins/agent/workspace/ct-ggRXjnY2MQ8l_java-demo_master/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/ct-ggRXjnY2MQ8l_java-demo_master/src/main/resources
[INFO] skip non existing resourceDirectory /home/jenkins/agent/workspace/ct-ggRXjnY2MQ8l_java-demo_master/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/ct-ggRXjnY2MQ8l_java-demo_master/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/ct-ggRXjnY2MQ8l_java-demo_master/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/ct-ggRXjnY2MQ8l_java-demo_master/target/test-classes
[INFO]
[INFO] — maven-surefire-plugin:2.18.1:test (default-test) @ devops-sample —
[INFO] Surefire report directory: /home/jenkins/agent/workspace/ct-ggRXjnY2MQ8l_java-demo_master/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.001 sec - in io.kubesphere.devops.HelloWorldControllerTest
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] ————————————————————————
[INFO] BUILD SUCCESS
[INFO] ————————————————————————
[INFO] Total time: 2.112 s
[INFO] Finished at: 2019-10-22T09:20:15Z
[INFO] ————————————————————————
[Pipeline] }
[Pipeline] // container
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (sonarqube analysis)
[Pipeline] container
[Pipeline] {
[Pipeline] withCredentials
[Pipeline] // withCredentials
[Pipeline] }
[Pipeline] // container
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (build & push)
Stage “build & push” skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (push latest)
Stage “push latest” skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (deploy to dev)
Stage “deploy to dev” skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (push with tag)
Stage “push with tag” skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (deploy to production)
Stage “deploy to production” skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: Could not find credentials entry with ID ‘31fb13cf879bc394fcbc84dd4c9151963b25d5a0’
Finished: FAILURE