thiDucTran commented on issue #5207:
URL: 
https://github.com/apache/incubator-devlake/issues/5207#issuecomment-2146830414

   @mars-esther  our argocd notification template ...we pass it in as arguments 
to our template . including repo url, env, webhook id, etc... see below
   ```yaml
   apiVersion: v1
   data:
     context: |
       argocdUrl:
     service.webhook.devlake: |
       url: http://apache-devlake-ui.infra.svc:4000
       headers:
       - name: Authorization
         value: Basic $devlake-basic-auth
     template.devlake-commit-status: |
       webhook:
         devlake:
           method: POST
           path: 
"/api/plugins/webhook/connections/{{.app.metadata.annotations.webhook}}/deployments"
           body: |
             {
               {{if eq .app.status.health.status "Healthy"}} "result": 
"SUCCESS"{{end}}
               {{if ne .app.status.health.status "Healthy"}} "result": 
"FAILURE"{{end}},
               "id": "{{.app.metadata.annotations.pipeline}}",
               "startedDate": "{{.app.status.operationState.startedAt}}",
               "finishedDate": "{{.app.status.operationState.finishedAt}}",
               "environment": "{{.app.metadata.annotations.env}}",
               "deploymentCommits":[
                 {
                   "startedDate": "{{.app.status.operationState.startedAt}}",
                   "finishedDate": "{{.app.status.operationState.finishedAt}}",
                   "repoUrl": "{{.app.metadata.annotations.repo}}",
                   "commitSha": "{{.app.metadata.annotations.sha}}"
                 }
               ]
             }
     trigger.on-deployed: |
       - when: app.status.operationState.phase in ['Succeeded'] and 
app.status.health.status != ''
         send: [devlake-commit-status]
     trigger.on-health-degraded: |
       - when: app.status.operationState.phase in ['Succeeded'] and 
app.status.health.status != ''
         send: [devlake-commit-status]
     trigger.on-sync-succeeded: |
       - when: app.status.operationState.phase in ['Succeeded'] and 
app.status.health.status != ''
         send: [devlake-commit-status]
   kind: ConfigMap
   ```
   
   one of our argocd application
   ```yaml
   apiVersion: argoproj.io/v1alpha1
   kind: Application
   metadata:
     name: dora-python-app-dev
     namespace: default
     finalizers:
     - resources-finalizer.argocd.argoproj.io
     annotations:
       sha: 'ce7038198a4639dcaacce3cf076ebdf65c438641'
       env: 'DEVELOPMENT'
       pipeline: 'dora-python-app-dev'
       repo: 'https://dev.azure.com/blah/foobar/_git/thi-test-dora-metrics'
       webhook: '1'
       notifications.argoproj.io/subscribe.on-deployed.devlake: ""
       notifications.argoproj.io/subscribe.on-health-degraded.devlake: ""
       notifications.argoproj.io/subscribe.on-sync-succeeded.devlake: ""
   spec:
     destination:
       name: aks-rd-occluster-dev
       namespace: omatic
     project: default
     source:
       path: ./argocd-files/overlays/legacy-dev
       repoURL: https://dev.azure.com/blah/foobar/_git/thi-test-dora-metrics
       targetRevision: 'main'
     syncPolicy:
       automated:
         prune: true
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@devlake.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to