请参考链接: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() {
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'
} }
}
 

Jenkins Pipeline waitForQualityGate pending 超时的更多相关文章

  1. Jenkins pipeline:pipeline 使用之语法详解

    一.引言 Jenkins 2.0的到来,pipline进入了视野,jenkins2.0的核心特性. 也是最适合持续交付的feature. 简单的来说,就是把Jenkins1.0版本中,Project中 ...

  2. Jenkins pipeline:pipeline 语法详解

    jenkins  pipeline 总体介绍 pipeline 是一套运行于jenkins上的工作流框架,将原本独立运行于单个或者多个节点的任务连接起来,实现单个任务难以完成的复杂流程编排与可视化. ...

  3. Jenkins pipeline 语法详解

    原文地址http://www.cnblogs.com/fengjian2016/p/8227532.html pipeline 是一套运行于jenkins上的工作流框架,将原本独立运行于单个或者多个节 ...

  4. 转~Jenkins pipeline:pipeline 使用之语法详解

    一.引言 Jenkins 2.0的到来,pipline进入了视野,jenkins2.0的核心特性. 也是最适合持续交付的feature. 简单的来说,就是把Jenkins1.0版本中,Project中 ...

  5. [转] Jenkins Pipeline插件十大最佳实践

    [From] http://blog.didispace.com/jenkins-pipeline-top-10-action/ Jenkins Pipeline 插件对于 Jenkins 用户来说可 ...

  6. jenkins pipeline的声明式与脚本式

    自从Jenkins 2.0 版本升级之后,支持了通过代码(Groovy DSL)来描述一个构建流水线,灵活方便地实现持续交付,大大提升 Jenkins Job 维护的效率,实现从 CI 到 CD 到转 ...

  7. jenkins pipeline构建后返回构建结果给gitlab

    jenkins pipeline构建后返回构建结果给gitlab 使用场景 gitlab 合并请求时要求管道任务必须成功,否则无法执行合并操作,又不想使用gitlab ci 工具. 实现方法 1.Ge ...

  8. 在容器中运行 Jenkins pipeline 任务

    持续集成中的 pipeline 技术和 docker 都是当前正在发展的主流方向,当然把它们结合起来在 CI/CD 过程中发挥出更强大的威力也是大家共同的目标.本文将介绍如何在 Jenkins pip ...

  9. 基于Jenkins Pipeline的ASP.NET Core持续集成实践

    最近在公司实践持续集成,使用到了Jenkins的Pipeline来提高团队基于ASP.NET Core API服务的集成与部署效率,因此这里总结一下. 一.关于持续集成与Jenkins Pipelin ...

随机推荐

  1. 3.Docker Compose 部署 GitLab

    什么是 GitLab GitLab 是利用 Ruby on Rails 一个开源的版本管理系统,实现一个自托管的 Git 项目仓库,可通过 Web 界面进行访问公开的或者私人项目.它拥有与 Githu ...

  2. react-绑定this并传参的三种方式

    绑定this并传参的三种方式 在事件中绑定this并传参: <input type="button" value="在事件中绑定this并传参" onCl ...

  3. poj2387- Til the Cows Come Home(最短路板子题)

    题目描述 Description Bessie is out in the field and wants to get back to the barn to get as much sleep a ...

  4. [hive]case 语句中字符串匹配

    当使用case when时,有时会需要对某个字段做子串匹配.如果是在where条件中,我们会直接使用 like '%xx%'来匹配,但case when语句不行 这时需要使用instr函数 examp ...

  5. 缓存 - 数据缓存 - IndexedDB - Dexie.js

    Classes Dexie DexieError Collection and():Add JS based criteria to collection(向集合添加基于JS的条件) delete() ...

  6. wso2 linux上部署说明

    1.启动wso2

  7. Vim入门——Windows下安装

    下载页面:https://www.vim.org/download.php Windows选用的是MS-Windows: 下图为展示: 因为最近被墙,镜像貌似没中国内陆地区,因此,选择使用GitHub ...

  8. 2018中国大学生程序设计竞赛 - 网络选拔赛---Find Integer!--hdu6441

    问题传送门:https://vjudge.net/contest/320779#problem/D 介绍一个名词:奇偶数列法则 Key part: #include<iostream> # ...

  9. glog入门demo

    glog 一. 下载与安装 git clone https://github.com/google/glog.git cd glog ./autogen.sh ./configure make mak ...

  10. JavaSwing开发简单的银行管理系统 附源码

    开发环境: Windows操作系统开发工具: MyEclipse/Eclipse+Jdk+mysql数据库 运行效果图: