• Jenkins Pipeline waitForQualityGate pending 超时


    请参考链接:http://www.iotxing.com/2019/06/12/258/jenkins-pipeline-waitforqualitygate%E8%B6%85%E6%97%B6/

    主要是因为sonaqube的一个小bug, 需要sleep 几秒

    pipeline {
        agent any
    
        //任务集合,一个大的任务
        stages {
            stage('代码获取') {
                steps {
                    checkout([$class: 'GitSCM', branches: [[name: '${git_version}']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '0f180207-47bf-20-a9-a20fd91f445f', url: 'git@gitlab.domain.com:xxx/monitor.git']]])
                }
            }
            stage('代码质检') {
                steps {
                    withSonarQubeEnv('SonarQube') {
                        sh '/usr/local/sonar-scanner/bin/sonar-scanner -Dsonar.projectKey=html -Dsonar.projectName=${JOB_NAME} -Dsonar.sources=.'
                    }
                        script {
                           timeout(1) {
                               sleep(5)
                               def qg = waitForQualityGate()
                               if (qg.status != 'OK') {
                                   error "未通过SonarQube的代码检查,请及时修改! failure: ${qg.status}"
                               }
                           }
                       }
                }
            }
            stage('代码构建') {
                steps {
                    echo "build is ok"
                }
            }
            stage('代码部署') {
                steps {
                    sh '/usr/local/shell/pipeline_deploy_html.sh'
                }
            }
        }
        post {
            failure {
                dingTalk accessToken: 'd631ae76dabd6fabba81b1fe4a7f3d2fe3a8da8636ba72554348efe1982a', imageUrl: '', jenkinsUrl: 'http://jenkins.domain.com:8080/', message: '代码部署失败', notifyPeople: 'phone' 
            }
            success {
                dingTalk accessToken: 'd631ae76dabd6fabba81b1fe4a7f3d2fe3a8da8636ba725348ef71e1982a', imageUrl: '', jenkinsUrl: 'http://jenkins.domain.com:8080/', message: '代码部署成功', notifyPeople: 'phone'
            }
    
        }
    }
     
  • 相关阅读:
    MySQL数据库的主从同步
    学习Java必看的Java书籍(高清中文最新版附下载链接)
    servlet重点知识总结
    JUnit & JMockit单元测试
    mongodb重点知识总结
    Quartz学习总结
    IDEA使用总结
    bat脚本知识总结
    linux shell脚本相关知识
    SpringMVC重点知识总结
  • 原文地址:https://www.cnblogs.com/faberbeta/p/jenkins001.html
Copyright © 2020-2023  润新知