jenkins pipeline try/catch/fina

2020-06-23  本文已影响0人  _fishman
pipeline {
    agent { node { label "master" }}
    stages {
        stage('test') {
            steps {
                script {
                        try {
                            sh "pwd"
                        } catch (Exception err) {
                            echo 'test failed'
                            currentBuild.result = 'FAILURE'
                        } finally {
                            cleanWs()
                        }
                }
            }
        }
    }
}
上一篇 下一篇

猜你喜欢

热点阅读