pipeline增加Checkstatus 阶段
// 检查pod状态 stage('Checkstatus') { steps { echo '检查pod存活状态' sleep 5 //sleep5秒,立马检测pod可能未拉起 script { def pod_check = sh(script: '/usr/local/bin/kubectl get pods -n ${project_env} |grep ${server_name} |grep Running |wc -l', returnStdout:true).trim() echo "return pod 存在个数为:${pod_check}" if(pod_check == '0'){ error "pod not start" } } }