xuhua912
有两种方式:
1,灵活点的。在使用图形化构建流水线时,选择 Kubernetes 构建,自己写一段 podtemplate,类似这样。
apiVersion: v1
kind: Pod
spec:
containers:
- name: robotframework
image: shaowenchen/docker-robotframework:latest
tty: true
volumeMounts:
- name: dockersock
mountPath: /var/run/docker.sock
- name: dockerbin
mountPath: /usr/bin/docker
volumes:
- name: dockersock
hostPath:
path: /var/run/docker.sock
- name: dockerbin
hostPath:
path: /usr/bin/docker
2,好用点的。修改 jenkins-casc-config,模仿内置的几个 podtemplate,再增加一个你需要的 slave 镜像。这样流水线就可以通过 label 和 container 选择指定环境进行构建。