Skip to content

CI/CD連携

概要

あらゆるCI/CDパイプラインにプッシュ通知と承認ゲートを追加。すべて依存関係ゼロ、オープンソース。


CLI

単一ファイルのシェルツール。あらゆるCI/CD、cronジョブ、ターミナルで動作。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 300

GitHub 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の2つのメソッドで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",
                )
            }
        }
    }
}