CI/CD 整合
概覽
為任何 CI/CD 管線新增推播通知和審批閘道。全部零依賴、開源。
命令列工具
單檔 Shell 工具。適用於任何 CI/CD、排程任務或終端。需要 curl 和 jq。
安裝
curl -fsSL https://raw.githubusercontent.com/qq418716640/botbell-cli/main/botbell -o /usr/local/bin/botbell
chmod +x /usr/local/bin/botbell
export BOTBELL_TOKEN="bt_your_token"發送
botbell send "Deploy succeeded ✅"審批閘道
botbell approve "Deploy to production?" --timeout 300GitHub Action
為 GitHub 工作流新增 BotBell 通知和審批閘道。
建置結果通知
workflow.yml
- uses: botbell/notify-action@v1
with:
token: ${{ secrets.BOTBELL_TOKEN }}
title: "✅ Build Passed"
message: "#${{ github.run_number }} on ${{ github.ref_name }}"部署前審批閘道
workflow.yml
- uses: botbell/notify-action@v1
with:
token: ${{ secrets.BOTBELL_TOKEN }}
mode: approve
message: "Deploy #${{ github.run_number }} to production?"
timeout: "1800"Jenkins 共享庫
透過 notify 和 approve 兩個方法將 BotBell 整合到 Jenkins 管線。
設定:在全域管線庫中新增並指向 Git 儲存庫。
Jenkinsfile
@Library('botbell') _
pipeline {
agent any
environment {
BOTBELL_TOKEN = credentials('botbell-token')
}
stages {
stage('Deploy Approval') {
steps {
script {
botbell.approve(message: "Deploy to production?")
}
}
}
}
post {
success {
script {
botbell.notify(
title: "✅ Deploy Success",
message: "#${BUILD_NUMBER} deployed",
)
}
}
}
}