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

ci: send notifications to teams channel #895

Merged
merged 13 commits into from
Oct 4, 2024
Merged

Conversation

miampf
Copy link
Contributor

@miampf miampf commented Sep 27, 2024

Add the post_to_teams github action that allows a workflow to post into the Contrast-CI-Notifications channel. Furthermore, integrate this action into weekly running actions.

@miampf miampf requested a review from katexochen as a code owner September 27, 2024 13:17
@miampf miampf added the no changelog PRs not listed in the release notes label Sep 27, 2024
@katexochen katexochen changed the title ci: Send notifications to teams channel ci: send notifications to teams channel Sep 27, 2024
run: |
curl \
-H "Content-Type: application/json" \
-d '{"workflow_name": "${{github.workflow}}", "job_id": "${{github.job}}", "run_id": "${{github.run_id}}", "ref": "${{github.ref_name}}", "message": "${{inputs.message}}"}' \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we quote the message string, or at least document what it may and may not contain?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like quoted strings just disappear from the message, should I just document this in the description of the workflow run?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documented this behavior in the description of the message parameter.

@katexochen
Copy link
Member

We should use a card like with Constellation and provide a direct link/button to the logs.

@miampf miampf force-pushed the miampf/e2e/send-notifs-to-teams branch 2 times, most recently from 7aa21c1 to c6f2707 Compare October 4, 2024 09:42
@miampf miampf force-pushed the miampf/e2e/send-notifs-to-teams branch 3 times, most recently from c0610fc to 5762ce9 Compare October 4, 2024 09:54
@miampf
Copy link
Contributor Author

miampf commented Oct 4, 2024

We should use a card like with Constellation and provide a direct link/button to the logs.

Cards are now posted in the corresponding channel.

@miampf miampf requested a review from burgerdev October 4, 2024 10:38
@katexochen
Copy link
Member

We should use a card like with Constellation and provide a direct link/button to the logs.

Cards are now posted in the corresponding channel.

Button to run seems to be broken?

@miampf
Copy link
Contributor Author

miampf commented Oct 4, 2024

We should use a card like with Constellation and provide a direct link/button to the logs.

Cards are now posted in the corresponding channel.

Button to run seems to be broken?

I don't think the buttons are broken, its just that the messages I sent contained quotes which seemingly broke the parsing of the workflow and caused the URL to be replaced with the last word of the quoted text. If you look at the card with run_id 11177841920 (which uses the same adaptive card layout) you'll see that the button works there :)

shell: bash
run: |
run_url="${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}"
payload="$(printf '{"workflow_name": "%s", "job_id": "%s", "run_id": "%s", "ref": "%s", "message": "%s", "run_url": "%s"}' \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as this gets more complex, we might want to have a template file, similar to the one in constellation.

@miampf miampf merged commit 9458437 into main Oct 4, 2024
24 checks passed
@miampf miampf deleted the miampf/e2e/send-notifs-to-teams branch October 4, 2024 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no changelog PRs not listed in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants