Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: github service only sends last template when triggered #229

Open
bradgwest opened this issue Oct 10, 2023 · 0 comments
Open

Bug: github service only sends last template when triggered #229

bradgwest opened this issue Oct 10, 2023 · 0 comments

Comments

@bradgwest
Copy link

Summary

Only the last template specified in a trigger will be sent when using the github service. I'm not sure if this behavior extends to other services.

Observed Behavior

Consider the following config. Note that two templates are specified in the "send" clause of the on-deployed trigger.

  trigger.on-deployed: |
      - description: Application successfully deployed
        send: [app-deployed, app-config-deployed]
        when: app.status.operationState.phase in ['Succeeded'] and app.status.health.status == 'Healthy'

  template.app-deployed: |
      message: |
        Successfully deployed `{{.app.metadata.name}}`.
      github:
        repoURLPath: '{{((first .app.status.sync.comparedTo.sources).repoURL)}}'
        revisionPath: "{{(first .app.status.sync.revisions)}}"
        status:
          state: success
          label: "continuous-delivery/{{.app.metadata.labels.environment}}/{{.app.metadata.name}}"
          targetURL: "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true"

  template.app-config-deployed: |
      message: |
        Successfully deployed `{{.app.metadata.name}}` with this config.
      github:
        repoURLPath: "git:github.com:org/config.git"
        revisionPath: "{{(last (last .app.status.history).revisions)}}"
        status:
          state: success
          label: "continuous-delivery/{{.app.metadata.labels.environment}}/{{.app.metadata.name}}"
          targetURL: "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true"

Only the app-config-deployed notification will be sent. The service quietly fails to send app-deployed. Not even a debug log is emitted.

Expected Behavior

  1. I expect an error log when a notification fails to send.
  2. I expect every templates/notifications specified in the send configuration of the trigger to be sent.
  3. I expect any deviation from this behavior to be documented.

Version

notifications-engine@v0.4.1-0.20230620204159-3446d4ae8520

Logs

info: Trigger on-deployed result: [{[0].y7b5sbwa2Q329JYH755peeq-fBs  [app-deployed app-config-deployed] true}]
info: Sending notification about condition 'on-deployed.[0].y7b5sbwa2Q329JYH755peeq-fBs' to '{github }'
debug: Sending request: POST /app/installations/redacted/access_tokens <redacted>
debug: msg="Received response: HTTP/2.0 201 Created <redacted>
debug: msg="Sending request: POST /repos/org/config/statuses/17b9362483179c29dfb79a5aa4bc7b41e01a229f <redacted>
debug: msg="Received response: HTTP/2.0 201 Created\r <redacted>
debug: Notification  was sent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant