fluxcloud icon indicating copy to clipboard operation
fluxcloud copied to clipboard

Add support for slack mrkdwn formatting

Open Dev25 opened this issue 5 years ago • 3 comments

Allow end users to have a BODY_TEMPLATE to contain slack's markup formatting as per their docs.

This is enabled by default however if there are concerns about it we can add a config flag to make it opt in?

Example use case is using code blocks in the notifications:

        env:
        - name: BODY_TEMPLATE
          value: |
            Event: {{ .EventString }}
            {{ if and (ne .EventType "commit") (gt (len .Commits) 0) }}
            {{ range .Commits }}
            * {{ call $.FormatLink (print $.VCSLink "/commits/" .Revision) (truncate .Revision 7) }}: `{{ .Message }}`
            {{end}}{{end}}
            {{ if (gt (len .EventServiceIDs) 0) }}Resources updated:
            ```{{ range .EventServiceIDs }}
            * {{ . }}
            {{ end }}```{{ end }}
            {{ if gt (len .Errors) 0 }}Errors:
            ```{{ range .Errors }}
            Resource {{ .ID }}, file: {{ .Path }}:

            > {{ .Error }}
            {{ end }}```{{ end }}

Dev25 avatar Jan 05 '20 20:01 Dev25

Welcome @Dev25! It looks like this is your first PR to justinbarrick/fluxcloud 🎉

oliviabarrick avatar Jan 05 '20 20:01 oliviabarrick

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Dev25 To fully approve this pull request, please assign additional approvers. We suggest the following additional approver: justinbarrick

If they are not already assigned, you can assign the PR to them by writing /assign @justinbarrick in a comment when ready.

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

oliviabarrick avatar Jan 05 '20 20:01 oliviabarrick

Hi @Dev25. Thanks for your PR.

I'm waiting for a justinbarrick member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

oliviabarrick avatar Jan 05 '20 20:01 oliviabarrick