We're updating our terminology in Jira

'Issue' is changing to 'work item'. You might notice some inconsistencies while this big change takes place.

CircleCI と統合する

この記事では、Jira Service Management Cloud の一部のお客様に段階的に展開されている、Jira Service Management でネイティブに利用できる新しいアラート機能を取り上げています。ご利用のサイトにはまだ表示されていないか、利用できない可能性があります。

CircleCI のロゴ

統合でできるようになること

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

統合による機能

  • CircleCI で結果が success と一致しない場合は、統合を通じて Jira Service Management でアラートが自動的に作成されます。

  • CircleCI で結果が success と一致する場合は、統合を通じて Jira Service Management の対応するアラート (存在する場合) が自動的にクローズされます。

統合をセットアップする

CircleCI は API 統合です。設定は次の手順で行います。

  • Jira Service ManagementCircleCI 統合を追加する

  • CircleCI で統合を設定する

CircleCI 統合を追加する

双方向統合は Free プランと Standard プランではサポートされていません。他のすべての統合は FreeStandard でチーム レベルでサポートされています。ただし、送信統合を機能させるには、上位のプランにアップグレードする必要があります。Settings (歯車アイコン) > Products (Jira 設定の下) > OPERATIONS からサイト レベルで統合を追加できるのは、Premium プランと Enterprise プランのみです。

統合をチームの運用ページから追加すると、そのチームが統合の所有者になります。つまり、Jira Service Management は、この統合を通じて受信したアラートをチームにのみ割り当てます。

Jira Service ManagementCircleCI 統合を追加するには、次の手順に従います。

  1. チームの運用ページに移動します。

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

  3. 検索を実行して [CircleCI] を選択します。

  4. 次の画面で、統合の名前を入力します。

  5. オプション: 特定のチームが統合からのアラートを受信するようにする場合は、[Assignee team (担当者チーム)] のチームを選択します。

  6. [Continue] を選択します。
    この時点で、統合が保存されます。

  7. [統合を設定する手順] セクションを展開して、API キーをコピーします。
    このキーは、後ほど CircleCI で統合を設定する際に使用します。

  8. [統合をオンにする] を選択します。
    統合のために作成したルールは、統合をオンにした場合にのみ機能します。

CircleCI で統合を設定する

CircleCIJira Service Management の統合を設定するには、次の手順に従います。

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

  2. {API_KEY} を前にコピーした API キーに置き換えてください。

テキスト

notify: webhooks: - url: https://api.atlassian.com/jsm/ops/integration/v1/json/integrations/webhooks/circleci?apiKey=${API_KEY}

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

アラートのペイロードを作成する

JSON

{ "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 } }

Jira Service Management ではペイロードは次のように解析されます。

JSON

{ "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 }

さらにヘルプが必要ですか?

アトラシアン コミュニティをご利用ください。