pipeline {
agent {
kubernetes {
yaml '''
apiVersion: v1
kind: Pod
metadata:
labels:
some-label: some01
spec:
containers:
- name: docker
image: docker:19.03-dind
command:
- dockerd
- --host=unix:///var/run/docker.sock
- --host=tcp://0.0.0.0:8000
securityContext:
privileged: true
tty: true
- name: kubectl
image: registry.cn-shenzhen.aliyuncs.com/jbjb/csi:kubectl
command:
- cat
tty: true
- name: gradle
image: gradle:6.7.1-jdk8-openj9
command:
- cat
tty: true
- name: git
image: ccr.ccs.tencentyun.com/devopss/dev:git
command:
- cat
tty: true
volumeMounts:
- mountPath: "/root/.m2"
name: "volume-0"
volumes:
- name: "volume-0"
persistentVolumeClaim:
claimName: "mvn"
'''
}
}
stages {
stage('Get Code') {
steps {
container('git') {
sh 'git clone -b dev git@gitJBJB.com
}
}
}
stage('gradle') {
steps {
container('gradle') {
sh '''
gradle clean
'''
}
}
}
stage('docker') {
steps {
container('docker') {
sh '''
docker -v
'''
}
}
}
stage('kubectl') {
steps {
container('kubectl') {
sh 'kubectl version'
}
}
}
}
}