- 已编辑
按官方文档
构建了一个流水线,无法正常启动
报错如下:
对应的 maven 容器 已经拉起来了
请大神些解决下
按官方文档
构建了一个流水线,无法正常启动
报错如下:
对应的 maven 容器 已经拉起来了
请大神些解决下
给出一个复现步骤呢。
Mike 好的,我尝试复现一下。
该问题已解决,原因是内置 pod template 里的镜像有问题。以 go 环境为例
我刚刚测试,builder-go:v3.1.0
这个镜像是没问题的,请看下面的测试过程:
下面是测试流水线:
pipeline {
agent {
label 'go'
}
stages {
stage('ss') {
steps {
container('go') {
sh 'go version'
}
}
}
}
}
下面是测试的输出日志:
Started by user admin
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] node
Agent go-j8gf2 is provisioned from template go
---
apiVersion: "v1"
kind: "Pod"
metadata:
annotations: {}
labels:
jenkins: "slave"
jenkins/label-digest: "e84a3b2cb16af20654b162562a7360c9fc00fd54"
jenkins/label: "go"
name: "go-j8gf2"
spec:
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- preference:
matchExpressions:
- key: "node-role.kubernetes.io/worker"
operator: "In"
values:
- "ci"
weight: 1
containers:
- command:
- "cat"
image: "kubesphere/builder-go:v3.1.0"
imagePullPolicy: "IfNotPresent"
name: "go"
resources:
limits:
ephemeral-storage: "10Gi"
memory: "8192Mi"
cpu: "4000m"
requests:
ephemeral-storage: "1Gi"
memory: "100Mi"
cpu: "100m"
tty: true
volumeMounts:
- mountPath: "/home/jenkins/agent"
name: "workspace-volume"
readOnly: false
- mountPath: "/root/.sonar/cache"
name: "volume-2"
readOnly: false
- mountPath: "/var/run/docker.sock"
name: "volume-0"
readOnly: false
- mountPath: "/home/jenkins/go/pkg"
name: "volume-1"
readOnly: false
workingDir: "/home/jenkins/agent"
- args:
- "********"
- "go-j8gf2"
command:
- "jenkins-slave"
env:
- name: "JENKINS_SECRET"
value: "********"
- name: "JENKINS_TUNNEL"
value: "ks-jenkins-agent.kubesphere-devops-system:50000"
- name: "JENKINS_AGENT_NAME"
value: "go-j8gf2"
- name: "JENKINS_NAME"
value: "go-j8gf2"
- 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: "/var/run/docker.sock"
name: "volume-0"
readOnly: false
- mountPath: "/home/jenkins/go/pkg"
name: "volume-1"
readOnly: false
- mountPath: "/home/jenkins/agent"
name: "workspace-volume"
readOnly: false
workingDir: "/home/jenkins/agent"
hostNetwork: false
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_go_cache"
name: "volume-1"
- emptyDir:
medium: ""
name: "workspace-volume"
Running on go-j8gf2 in /home/jenkins/agent/workspace/demo
[Pipeline] {
[Pipeline] stage
[Pipeline] { (ss)
[Pipeline] container
[Pipeline] {
[Pipeline] sh
+ go version
go version go1.12.10 linux/amd64
[Pipeline] }
[Pipeline] // container
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS
下面是我的镜像的详细信息,帮忙提供下你那边的:
[root@i-q73jfmqj ~]# docker pull kubesphere/builder-go:v3.1.0
v3.1.0: Pulling from kubesphere/builder-go
Digest: sha256:5b017039ba045c9d30904e97e65fed1239b3e87fb8519e383a25faa42bc2fd9c
Status: Image is up to date for kubesphere/builder-go:v3.1.0
docker.io/kubesphere/builder-go:v3.1.0
最最最后的结论:根本原因还是官方这个3.1 的镜像太大了 1.43 G 节点还没下载完引起的 手动提前在节点上下载好镜像
就可以了