相关代码提交至 GitHub -> https://github.com/wangyuheng/keeper 欢迎提交 issue
What
监听 Gitlab Hook
事件, 紧急消息通过 钉钉机器人
发送至钉钉群组, 并 @(提醒)
相关方. 同时自动流转 issue 的 pipeline
.
Why
- 紧急事项实时提醒到人
- 定制 pipeline & 自动流转
为什么不通过钉钉自带的 gitlab 机器人 或者 gitlab notify email?
- 发送的消息过多, 会忽略有意义的信息
- 不能 @ 到相关的人, 达不到提醒的作用
How
pipeline
根据团队状况制定 pipeline
, 基于事件自动流转. 比如:
- 新建
:WIP MR
时流转至 doing - CICD 流转至 deploy
- 发布成功后流转至 verify 并修改 assignee 为 author
Emergency issue
通过 label 判断是否为紧要消息, 比如 Bug
、P0
.
core code
private fun handlerIssue(body: JSONObject) { if (GitlabHookBodyHelper.isClose(body)) { //已关闭的issue不做处理 return } val changedAssignee: GitlabHookBodyHelper.Assignee? = getChangedAssignee(body) log.info("handler issue changedAssignee: $changedAssignee") val labelTitles: MutableSet<String> = GitlabHookBodyHelper.listLabelTitle(body) log.info("handler issue labels: $labelTitles") // 是否变更assignee if (changedAssignee != null) { val developer = developerRepository.findByUsername(changedAssignee.username!!) // 为开发人员 && label为todo且不在进行中 if (developer != null && labelTitles.isTodo() && !labelTitles.isProcessing()) { when { labelTitles.isBug() -> sendBugMsg(body, developer.mobile) labelTitles.isP0() -> sendEmergencyMsg(body, developer.mobile) else -> log.info("ignore issue change! labelTitles -> $labelTitles") } } } else { if (GitlabHookBodyHelper.isFirstChangeToVerifyLabel(body)) { val author = getAuthor(body) val assigneeUsername = editAssignee(body, author) val mobile = developerRepository.findByUsername(assigneeUsername)?.mobile if (null != mobile) { sendVerifyMsg(body, author, mobile) } } } }
小技巧
非内网部署 gitlab 如何开发调试
ngrok 实现内网穿透
brew cask install ngrok
验证阶段的 issue 关闭不及时
先自动 close
issue, 并 dingding
提醒. 如果有问题可以 reopen
并自动流转至 Doing
.
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于