Akiraka Akiraka
  • Home
  • Linux
    • ELK
    • PHP
    • Shell
    • Nginx
    • Docker
      • Docker Compose
    • Centos
    • Ubuntu
    • Jenkins
  • Python
  • Mac OS
  • Windows
  • Big Data
    • Hadoop
    • CDH
    • Hive
    • Spark
    • ZooKeeper
  • K8S
    • Kubernetes
    • Helm
  • Other
  • Quark
  • Contribute
  • Home
  • Linux
    • ELK
    • PHP
    • Shell
    • Nginx
    • Docker
      • Docker Compose
    • Centos
    • Ubuntu
    • Jenkins
  • Python
  • Mac OS
  • Windows
  • Big Data
    • Hadoop
    • CDH
    • Hive
    • Spark
    • ZooKeeper
  • K8S
    • Kubernetes
    • Helm
  • Other
  • Quark
  • Contribute
首页 Linux Jenkins 钉钉dingtalk消息pipline 流水线通知

钉钉dingtalk消息pipline 流水线通知

Akiraka 1年前

需要后台获取钉钉id

方法一

#!groovy
def RoBot="5f2e3130-a722-4484-bd6e-83a9ad18b205"
pipeline {
  agent any
  stages {
    stage('拉取代码') {
      steps {
        sh" echo 拉取代码"
      }
    }
  }
  post {
    success {
      script {def msg = "【${JOB_NAME}】 项目打包成功,请及时处理!"
        def imageUrl = "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1729441498,1472936606&fm=26&gp=1.jpg"
        // 需要 DingTalk 插件支持
        dingtalk(
          robot: "${RoBot}",
          type: 'LINK',
          title: ' 监控报警 ',
          text: ["asdasdas"],
          messageUrl: "${BUILD_URL}",
          picUrl: "asdasd"
        )
        println " 构建成功!"
        currentBuild.description = " 工单系统生产环境构建成功!"
      }
    }
    failure {
      script {def msg = "【${JOB_NAME}】项目打包失败,请及时处理!"
        def imageUrl = "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1729441498,1472936606&fm=26&gp=0.jpg"
        // 需要 DingTalk 插件支持
        dingtalk(
          robot: "${RoBot}",
          type: 'LINK',
          title: ' 监控报警 ',
          text: ["asdasd"],
          messageUrl: "${BUILD_URL}",
          picUrl: "asdasd"
        )
        println " 构建失败!"
        currentBuild.description = " 工单系统生产环境构建失败!"
      }
    }
    aborted {
      script {def msg = "【${JOB_NAME}】 项目打包终端,请及时处理!"
        def imageUrl = "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1729441498,1472936606&fm=26&gp=2.jpg"
        // 需要 DingTalk 插件支持
        dingtalk(
          robot: "${RoBot}",
          type: 'LINK',
          title: ' 监控报警 ',
          text: ["asdasd"],
          messageUrl: "${BUILD_URL}",
          picUrl: "asdasd"
        )
        println " 构建中断,请联系相关服务人询问中断原因!"
        currentBuild.description = " 工单系统生产环境构建中断!"
      }
    }
  }
}

方法二

#!groovy
def RoBot="5f2e3130-a722-4484-bd6e-83a9ad18b205"
pipeline {
  agent any
  stages {
    stage('拉取代码') {
      steps {
        sh" echo sadasdad"
      }
    }
  }
  post {
    success {
      echo "发版成功"
      dingtalk (
      robot: "${RoBot}",
      type: 'LINK',
      at:[],
      atAll: false,
      title: "${JOB_NAME}-发版成功!",
      text:["autobole 更新记录\n"],
      messageUrl: "${BUILD_URL}",
      picUrl:'http://kmzsccfile.kmzscc.com/upload/2020/success.jpg',
      singleTitle:'',
      btns: [],
      hideAvatar: false
      )
    }
    failure {
      echo "发布错误"
      dingtalk (
      robot: "${RoBot}",
      type: 'LINK',
      at:["12333333333"],
      atAll: false,
      title: "${JOB_NAME}-发版错误!",
      text:["autobole 请管理员及时处理!"],
      messageUrl: "${BUILD_URL}",
      picUrl:'http://kmzsccfile.kmzscc.com/upload/2020/error.jpg',
      singleTitle:'',
      btns: [],
      hideAvatar: false
      )  
    }
  }
}
#dintalk#jenkins#pipline
1
猜你喜欢
  • Jenkins 升级失败
  • Jenkins 使用Gitlab账号做用户权限管理
  • Jenkins Docker Compose
  • Jenkins 插件与主题配置
  • jenkins 镜像加速
评论 (0)
请登录以参与评论。
立即登录
    暂无评论
Akiraka
站长
本人擅长 Ai、Au、Fl、Ae、Pr、Ps 等软件的安装与卸载,精通 CSS、JavaScript、PHP、Python、Shell、Go 等单词的拼写,熟悉 Windows、Linux、Mac、Android、IOS 等系统的开关机!
160
文章
24
评论
73
获赞
Popular Articles
TOP1
Kubernetes(k8s)Helm 部署 EFK 集群
2年前
TOP2
Kubernetes(k8s)helm 搭建 prometheus + Grafana 监控
2年前
TOP3
Container 命令ctr、crictl 命令使用说明
11月前
TOP4
Kubernetes(k8s)Helm 部署 Jenkins 持续化集成部署
2年前
TOP5
Helm 部署 Loki 日志聚合
2年前
Related Articles
jenkins 镜像加速
2年前
Jenkins 使用Gitlab账号做用户权限管理
5月前
钉钉dingtalk消息pipline 流水线通知
1年前
Grails+Gradle+Maven+NodeJs 环境变量
2年前
Jenkins Docker Compose
2年前
Copyright © 2019-2022 Akiraka. 沪18036911号