美文网首页
Jenkins捕获异常

Jenkins捕获异常

作者: 土豆与番茄 | 来源:发表于2018-09-21 15:53 被阅读0次

    使用捕获异常的方法来实现这一步!

    stage('单元测试') {

                steps {

                                    echo "starting unitTest......"

                                    script {

     try {

                                                 checkout scm

                                 def gradlePATH = "/var/jenkins_home/tools/hudson.plugins.gradle.GradleInstallation/gradle3.5"

                                 dir(env.JOB_NAME){

                                                sh "cp ${WORKSPACE}/${k8sPath}/Jenkinsfile ."

                                                sh "${gradlePATH}/bin/gradle clean build -x test "

                                                            }       

                                   }

    catch (err){

    echo "gradle构建出错了,请您检查错误信息"

    exit 1

                                                   }       

                                         }

                                }

    相关文章

      网友评论

          本文标题:Jenkins捕获异常

          本文链接:https://www.haomeiwen.com/subject/cgtznftx.html