---
sourceDocument: Xanadu IT Service Management
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/ja-JP/xanadu/it-service-management

 Release :

    - xanadu

ft:locale :

    - ja-JP

ft:publication_title :

    - Xanadu IT Service Management

ft:clusterId :

    - itsm

bundleId :

    - itsm

workflow :

    - Technology


---

# Argo CD での Webhook の手動構成

# Argo CD での Webhook の手動構成 {#ariaid-title1}

* リリースバージョン: Xanadu
* 
* 更新日 2024年08月01日
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 所要時間：4分

Argo CD で Webhook を構成して、DevOps チェンジベロシティアプリケーションに同期通知を送信します。

## 始める前に

必要なロール:Argo CD admin

## このタスクについて

Argo CD アプリケーションイベントのサブスクリプションは、 `notifications.argoproj.io/subscribe.<trigger>.<service>: <recipient>` アノテーションを使用して定義できます。

## 手順

1. Argo CD で、 ConfigMap: argocd-notifications-cm.yaml を更新して、 DevOps チェンジベロシティに送信する通知を設定します。  

       apiVersion: v1 
       kind: configMap 
       metadata: 
       annotations: 
       name: argocd-notifications-cm 
       namespace: default 
       data: 
       context:| 
          argocdUrl: "https://<argocdURL>" 
       service.webhook.sn_devops_argocd: | 
          url: https://<instance>.service-now.com/api/sn_devops/v2/devops/tool/orchestration?toolId=<toolId> 
          basicAuth: #optional username password 
            username: "" 
            password: "" 
       template.app-sync-succeeded: | 
          webhook: 
            sn_devops_argocd: 
              method: POST 
              body: | 
                {  
                "titleLink" : "http://<argocdURL>/applications/{{.app.metadata.name}}", 
                "syncStatus" : "{{.app.status.sync.status}}", 
                "repo" : "{{.app.spec.source.repoURL}}", 
                "revision": "{{.app.status.sync.revision}}", 
                "path": "/repos/{{call .repo.FullNameByRepoURL .app.spec.source.repoURL}}/statuses/{{.app.status.operationState.operation.sync.revision}}", 
                "commitAuthor" : "{{(call .repo.GetCommitMetadata .app.status.sync.revision).Author}}", 
                "commitMessage" : "{{(call .repo.GetCommitMetadata .app.status.sync.revision).Message}}", 
                "commitTags" : "{{(call .repo.GetCommitMetadata .app.status.sync.revision).Tags}}", 
                "startedAt" : "{{.app.status.operationState.startedAt}}", 
                "finishedAt" : "{{.app.status.operationState.finishedAt}}", 
                "message": "{{.app.metadata.name}} app is synced" 
                } 
       trigger.on-sync-status-unknown: | 
          - description: Application status is 'Unknown' 
            send: 
            - app-sync-status-unknown 
            when: app.status.sync.status == 'Unknown' 
       trigger.on-sync-succeeded: | 
          - description: Application syncing has succeeded 
            send: 
            - app-sync-succeeded 
            when: app.status.operationState.phase in ['Succeeded'] 
       subscriptions: | 
          - recipients: 
            - sn_devops_argocd 
            triggers: 
            - on-sync-succeeded 
            - on-sync-status-unknown

2. Webhook を構成する Argo CD アプリを開きます。
3. \[ アプリの詳細\] \> \[サマリー\] に移動します。
4. notifications.argoproj.io/subscribe.\<trigger\>.\<service\>: \<recipient\> 注釈をトリガー条件とともに追加して、インスタンスの変更ステータスを同期します。  
   たとえば、notifications.argoproj.io/subscribe.on-sync-succeeded.sn_devops_argocd などです。

