This repository has been archived by the owner on Oct 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Pipeline Notification
yuanbohan edited this page Mar 15, 2017
·
1 revision
BearyChat Jenkins 插件在 2.2 之后 (包含 2.2) 支持了 Pipeline 特性, 旧版本不支持 pipeline.
在 Pipeline 脚本中, 按照如下使用:
bearychatSend (message: 'test', channel: 'CI通知')
参数说明:
名称 | 类型 | 说明 |
---|---|---|
message | string (required) | Jenkins 消息 |
channel | string (optional) | 发送到的目标讨论组名称, 如果为空, 则发送到 Jenkins 机器人默认的讨论组 |
Declarative Pipeline Sample:
pipeline {
agent any
stages {
stage('prepare') {
steps {
echo 'checkout scm'
echo 'test'
echo 'build'
bearychatSend (message: "@bobo *Prepare Pipeline*: Job [#${env.JOB_NAME} ${env.BUILD_NUMBER}](${env.BUILD_URL})")
}
}
stage('deploy') {
steps {
echo 'scp files or Dockerfile'
echo 'restart service'
bearychatSend (message: "@bobo *Deploy Pipeline*: Job [#${env.JOB_NAME} ${env.BUILD_NUMBER}](${env.BUILD_URL})")
}
}
}
post {
always {
bearychatSend (message: "@group *Done Pipeline*: Job [#${env.JOB_NAME} ${env.BUILD_NUMBER}](${env.BUILD_URL})")
}
}
}
- 2.1 之前(包含 2.1) 不支持 pipeline 特性
- 如果想在消息中 at 某人, 可以通过使用
@group
或@one_username
来增加 at 提醒, 标注消息的重要性