argoproj / notifications-engine

Affordable notifications for Kubernetes
Apache License 2.0
264 stars 134 forks source link

Argo status on Github takes a long time to report #247

Closed ferwguerra closed 7 months ago

ferwguerra commented 7 months ago

After a deployment, we are sending notification of Argo status as Github status.

image

To read the value of that state, we are using the Github API, waiting up to 9 minutes (the time in which the Argo notification should be reported).

Using metrics, we have seen that the Argo notification is taking up to 19 minutes to be pushed to Github.

The app repository and gitops are in different repositories (that's why we have a custom configuration in repoURLPath and revisionPath).

The configuration for notifications is the following:

         notifiers:
            service.github: |
              appID: ${appID}
              installationID: ${installationID}
              privateKey: $github-privateKey
              enterpriseBaseURL: https://${GITHUB_URL}/api/v3
          templates:
            template.app-deployed: |
              message: |
                Application {{ printf "{{ .app.metadata.name }}" }} is now running new version of deployments manifests.
              github:
                repoURLPath: {{ printf "'{{ (index .app.spec.info 0).value }}'" }}
                revisionPath: {{ printf "'{{ (index .app.spec.info 1).value }}'" }}
                status:
                  state: success
                  label: "continuous-delivery/{{ printf "{{ .app.metadata.name }}" }}"
                  targetURL: "{{ printf "{{ .context.argocdUrl }}" }}/applications/{{ printf "{{ .app.metadata.name }}" }}?operation=true"
          triggers:
            trigger.on-deployed: |
              - description: Application is synced and healthy. Triggered once per commit.
                oncePer: app.status.sync.revision
                when: "time.Now().Sub(time.Parse(app.status.operationState.finishedAt)).Minutes() >= 1 and app.status.operationState.phase in [ 'Succeeded' ] and app.status.health.status == 'Healthy'"
                send: [ app-deployed ]
          logLevel: debug

The POST that we can see in the logs from the notifications-engine is

POST /api/v3/repos/{org}/{repoName}/statuses/{commit}

Is this a bug or is it an expected behavior? If this is an expected behaviour, how much is the time we have to wait for the state in Github?