jenkins管道总是失败

我的Jenkins管道阶段都很成功,但构建总是说它失败了.为了清楚起见,构建是成功的,我希望它与Jenkins注册成功,但出于某种原因jenkins认为它失败了.所有阶段都表示在仪表板中成功,但构建标记为红色球,控制台输出以Finished:FAILURE结束.

这是我的管道文件

node {
    try{
        stage 'Clone repo'
        sh 'gcloud source repos clone <repo-name> --project=<project-name>'
        dir('<repo-name>') {
            try{
                stage 'Run tests'
                sh './gradlew test'
                stage 'Run integration tests'
                sh './gradlew integrationTest'
                publishHTML(target: [
                    allowMissing: false, 
                    alwaysLinkToLastBuild: false, 
                    keepAll: false, 
                    reportDir: '<repo-name>/build/reports/integrationTest', 
                    reportFiles: 'index.html', 
                    reportName: 'Integration Test Reports'])
            } finally {
                stage 'Stop and remove docker containers'
                sh 'docker-compose down'
                sh 'docker-compose rm -f'
            }
        }
    } finally {
        deleteDir()
    }
}

最佳答案 我意识到当我实际进入dir块时,我已经包含了html报告的完整路径.日志中没有任何迹象表明这一点.

点赞