我正在尝试建立声明性管道,在该管道中我想将工作空间作为卷声明保留,因此较大的git checkout可以更快。基于doc,有选项workspaceVolume
和persistentVolumeClaimWorkspaceVolume
,但我无法使其工作-jenkins始终执行以下操作:
volumeMounts:
- mountPath: "/home/jenkins/agent"
name: "workspace-volume"
readOnly: false
volumes:
- emptyDir: {}
name: "workspace-volume"
答案 0 :(得分:3)
尝试类似
function defined<T, U>(x: T | undefined, dflt: U): T | U {
return typeof x !== "undefined" ? x : dflt;
}
obj[k] = defined(_e[k], "").toString(); // refactor 2
答案 1 :(得分:1)
以下是声明性管道的示例:
pipeline {
agent {
kubernetes {
yamlFile 'jenkins/pv-pod.yaml'
workspaceVolume persistentVolumeClaimWorkspaceVolume(claimName: 'workspace', readOnly: false)
}
}
答案 2 :(得分:0)
如果您发布jenkins部署,那么我可能会提供帮助。
表示您可以访问我使用过的Yaml,并且对我来说效果很好。
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: jenkins
spec:
replicas: 1
template:
metadata:
labels:
app: jenkins
spec:
containers:
- name: jenkins
image: jenkins:2.32.2
ports:
- containerPort: 8080
volumeMounts:
- name: jenkins-home
mountPath: /var/jenkins_home
volumes:
- name: jenkins-home
emptyDir: {}