• 製品
  • 使用を開始する
  • 関連ドキュメント
  • リソース

Opsgenie を CircleCI と統合する

CircleCI のロゴ

Opsgenie が CircleCI ユーザーに提供するもの

Opsgenie は、Circle CI との特定の API 統合を持っています。CircleCI は Opsgenie API にビルド結果と詳細な情報を送信します。OpsgenieCircleCI のビルド エラーのディスパッチャーであり、オンコール スケジュールに基づいて通知する適切な担当者を決定します。メール、テキスト メッセージ (SMS)、電話、iPhone や Android のプッシュ通知によって通知を行い、アラートが確認されるかクローズされるまでアラートをエスカレートします。

統合の機能性

  • CircleCI で結果が一致しない場合は、統合によって Opsgenie でアラートが自動で作成されます。

  • CircleCI での結果が success と等しく、Opsgenie の対応するアラートが存在する場合は、統合によって自動でクローズされます。

Opsgenie で CircleCI インテグレーションを追加する

Opsgenie の Free プランまたは Essentials プランを使用している、または Jira Service Management の Standard プランで Opsgenie を使用している場合は、チーム ダッシュボードからのみこの統合を追加できます。このプランでは、[設定] の [統合] ページが利用できません。

  1. [チーム] に移動して自分のチームを選択します。

  2. 左側のナビゲーションで [統合] を選択し、[統合を追加] を選択します。

統合をチーム ダッシュボードから追加すると、そのチーム統合の所有者になります。Opsgenie では、この統合を通じて受信したアラートはそのチームのみに割り当てられます。このセクションの残りの手順に従って、統合を設定してください。

  1. [設定] > [統合] の順に移動します。CircleCI を検索して [追加] を選択します。 

  2. [応答者] フィールドによって CircleCI アラートの通知先を指定します。入力し始めると、オートコンプリートの候補が表示されます。

  3. 統合 API キーをコピーして、CircleCI 設定で使用します。

  4. [Save Integration (統合の保存)] を選択します。

CircleCI での設定

  1. circle.yml ファイルに次の設定を追加します。

テキスト

1 2 3 notify: webhooks: - url: https://api.opsgenie.com/v1/json/circleci?apiKey=${API_KEY}

ここで、${API_KEY} は以前コピーした統合 API キーです。

CircleCI から送信されるペイロードの例

アラートのペイロードを作成します。

JSON

 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 { "id": "8bd71c28-4969-3677-8940-3e3a61c46660", "type": "job-completed", "happened_at": "2021-09-01T22:49:34.279Z", "webhook": { "id": "cf8c4fdd-0587-4da1-b4ca-4846e9640af9", "name": "Sample Webhook" }, "project": { "id": "84996744-a854-4f5e-aea3-04e2851dc1d2", "name": "webhook-service", "slug": "github/circleci/webhook-service" }, "organization": { "id": "f22b6566-597d-46d5-ba74-99ef5bb3d85c", "name": "circleci" }, "pipeline": { "id": "1285fe1d-d3a6-44fc-8886-8979558254c4", "number": 130, "created_at": "2021-09-01T22:49:03.544Z", "trigger": { "type": "webhook" }, "vcs": { "provider_name": "github", "origin_repository_url": "https://github.com/circleci/webhook-service", "target_repository_url": "https://github.com/circleci/webhook-service", "revision": "1dc6aa69429bff4806ad6afe58d3d8f57e25973e", "commit": { "subject": "Description of change", "body": "More details about the change", "author": { "name": "Author Name", "email": "author.email@example.com" }, "authored_at": "2021-09-01T22:48:53Z", "committer": { "name": "Committer Name", "email": "committer.email@example.com" }, "committed_at": "2021-09-01T22:48:53Z" }, "branch": "main" } }, "workflow": { "id": "fda08377-fe7e-46b1-8992-3a7aaecac9c3", "name": "welcome", "created_at": "2021-09-01T22:49:03.616Z", "stopped_at": "2021-09-01T22:49:34.170Z", "url": "https://app.circleci.com/pipelines/github/circleci/webhook-service/130/workflows/fda08377-fe7e-46b1-8992-3a7aaecac9c3" }, "job": { "id": "8b91f9a8-7975-4e60-916c-f0152ccbc937", "name": "test", "started_at": "2021-09-01T22:4:28.841Z", "stopped_at": "2021-09-01T22:49:34.170Z", "status": "success", "number": 136 } }

このペイロードは Opsgenie によって次のように解析されます。

JSON

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 { "id": "8bd71c28-4969-3677-8940-3e3a61c46660", "type": "job-completed", "happened_at": "2021-09-01T22:49:34.279Z", "webhook_id": "cf8c4fdd-0587-4da1-b4ca-4846e9640af9", "webhook_name": "Sample Webhook", "project_id": "84996744-a854-4f5e-aea3-04e2851dc1d2", "project_name": "webhook-service", "project_slug": "github/circleci/webhook-service" "pipeline_id": "1285fe1d-d3a6-44fc-8886-8979558254c4", "pipeline_number": 130, "pipeline_created_at": "2021-09-01T22:49:03.544Z", "pipeline_trigger_type": "webhook" "provider_name": "github", "repository_url": "https://github.com/circleci/webhook-service", "revision": "1dc6aa69429bff4806ad6afe58d3d8f57e25973e", "subject": "Description of change", "body": "More details about the change", "author_name": "Author Name", "author_email": "author.email@example.com", "authored_at": "2021-09-01T22:48:53Z", "committer_name": "Committer Name", "committer_email": "committer.email@example.com" "committed_at": "2021-09-01T22:48:53Z" "branch": "main", "workflow_id": "fda08377-fe7e-46b1-8992-3a7aaecac9c3", "workflow_name": "welcome", "workflow_created_at": "2021-09-01T22:49:03.616Z", "workflow_stopped_at": "2021-09-01T22:49:34.170Z", "workflow_url": "https://app.circleci.com/pipelines/github/circleci/webhook-service/130/workflows/fda08377-fe7e-46b1-8992-3a7aaecac9c3", "job_id": "8b91f9a8-7975-4e60-916c-f0152ccbc937", "job_name": "test", "job_started_at": "2021-09-01T22:49:28.841Z", "job_stopped_at": "2021-09-01T22:49:34.170Z", "job_status": "success", "job_number": 136 }

その他のヘルプ