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: report failures on discord #19801

Merged
merged 25 commits into from
Nov 14, 2022
Merged

CI: report failures on discord #19801

merged 25 commits into from
Nov 14, 2022

Conversation

yannbf
Copy link
Member

@yannbf yannbf commented Nov 11, 2022

Issue:

What I did

Set up a reporting mechanism that will post updates to discord on workflow failures:

image

How to test

  • Is this testable with Jest or Chromatic screenshots?
  • Does this need a new example in the kitchen sink apps?
  • Does this need an update to the documentation?

If your answer is yes to any of these, please make sure to include it in your PR.

@yannbf yannbf added the build Internal-facing build tooling & test updates label Nov 11, 2022
@yannbf yannbf marked this pull request as ready for review November 11, 2022 15:58
@kasperpeulen kasperpeulen self-requested a review November 12, 2022 19:24
Copy link
Contributor

@kasperpeulen kasperpeulen left a comment

Choose a reason for hiding this comment

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

This is awesome!

command: git fetch --unshallow
- list-recent-merges
- discord/status:
only_for_branches: chore/failure-reports
Copy link
Contributor

Choose a reason for hiding this comment

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

This is nice, I think if we do this only for the next and alpha branch, we have exactly what we want.

I first thought about only notifying on the merged and daily workflow, but that would also notify when you run the daily workflow in your PR.

So setting this to `next would be better I guess.

Copy link
Member Author

Choose a reason for hiding this comment

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

I had a similar thought and I think it makes sense too, I'll leave both next and alpha branches there, possibly updating to main in the future too 🤔

@yannbf yannbf marked this pull request as draft November 14, 2022 08:55
@yannbf yannbf force-pushed the chore/failure-reports branch 5 times, most recently from 982b3ed to 4f9da2f Compare November 14, 2022 11:24
@yannbf yannbf marked this pull request as ready for review November 14, 2022 11:47
- discord/status:
only_for_branches: next,alpha
fail_only: true
failure_message: 'Oh no! The **$CIRCLE_JOB** job has failed for **<< parameters.template >>**.\n\n**Relevant PRs of the last 24h:**\n$(git log --merges --since="24 hours ago" --pretty=format:"\`%h\` %<(12)%ar %s [%an]" | grep "Merge pull request" | sed "s/Merge pull request #/https:\/\/github.com\/storybookjs\/storybook\/pull\//g" | tr "\\n" "\\\\n" | sed "s/\\\\/\\\\n/g")'
Copy link
Member Author

Choose a reason for hiding this comment

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

tr and sed are used to replace line breaks with literal \n so they can display multiline results in discord:

image

Copy link
Contributor

@JReinhold JReinhold left a comment

Choose a reason for hiding this comment

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

Looks great!

Two suggestions.

  1. Would it make sense to include in the message if this was merged or daily that failed? Would make it easier to narrow down when the issue was introduced
  2. similarly, it might be easier to debug errors in merged if they only included the PR that actually got merged, and not the most recent ones.

EXCEPT if new merges cancels eachother out, I don't know. Eg. if Yann merges something to next, and I do too 3 minutes later. If my merge cancels Yann's, then an error in Yann's merge will be caught in mine, and so we would need all the recent PRs. If that is the case, disregard what I wrote.

@ndelangen ndelangen merged commit 6c5c6f4 into next Nov 14, 2022
@ndelangen ndelangen deleted the chore/failure-reports branch November 14, 2022 12:52
@ndelangen
Copy link
Member

ndelangen commented Nov 14, 2022

new merges cancels each other out

yes they do.

@kasperpeulen
Copy link
Contributor

@ndelangen @JReinhold
They are canceled, with the exception for the default branch (next):
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Internal-facing build tooling & test updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants