-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
5532beb
CI: add discord reports on failure
yannbf 3ef5820
fake an e2e failure for testing purposes
yannbf 3a6721a
remove webhook property
yannbf 750a289
add branch filtering for discord hook
yannbf 1f1f5c3
only provide reports on failure
yannbf 41efbc6
add template name to report message
yannbf 422ef5c
experiment
yannbf fa9d0de
move set-current-running-template inside of reporting step
yannbf e2055b7
list merges of last 24h on failure
yannbf ab084c6
switch failure experimentations
yannbf c14e425
checkout before reporting
yannbf a39923c
expand git history before reporting
yannbf 5a2b399
run git fetch on failures
yannbf 05df2eb
pass template as a parameter
yannbf 117942e
fix git log command
yannbf 1213076
experiment with git log messages in discord
yannbf 580715a
add github link to PRs
yannbf 7c852f9
undo failure
yannbf 54b48b9
Update report message format
yannbf 2a5f3c3
redo failure
yannbf 938f7f0
change report format
yannbf 1c85960
move error up for faster feedback
yannbf 89e741e
change report format
yannbf d906410
undo failure
yannbf 81620c4
finalize discord config
yannbf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,7 @@ executors: | |
orbs: | ||
git-shallow-clone: guitarrapc/[email protected] | ||
browser-tools: circleci/[email protected] | ||
discord: antonioned/[email protected] | ||
|
||
commands: | ||
# Forked off from https://github.com/guitarrapc/git-shallow-clone-orb | ||
|
@@ -175,6 +176,30 @@ commands: | |
echo "Canceling workflow as previous step resulted in failure." | ||
echo "To execute all checks locally, please run yarn ci-tests" | ||
curl -X POST --header "Content-Type: application/json" "https://circleci.com/api/v2/workflow/${CIRCLE_WORKFLOW_ID}/cancel?circle-token=${WORKFLOW_CANCELER}" | ||
list-recent-merges: | ||
description: 'Lists the merge commits from the past 24 hours' | ||
steps: | ||
- run: | ||
name: Listing merge commits from the past 24 hours | ||
when: on_fail | ||
command: | | ||
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" | ||
report-workflow-on-failure: | ||
description: 'Reports failures to discord' | ||
parameters: | ||
template: | ||
description: | | ||
Which template to report in discord | ||
type: string | ||
steps: | ||
- run: | ||
when: on_fail | ||
command: git fetch --unshallow | ||
- list-recent-merges | ||
- 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")' | ||
jobs: | ||
build: | ||
executor: | ||
|
@@ -410,7 +435,9 @@ jobs: | |
at: . | ||
- run: | ||
name: Creating Sandboxes | ||
command: yarn task --task sandbox --template $(yarn get-template << pipeline.parameters.workflow >> create) --no-link --start-from=never --junit | ||
command: yarn task --task sandbox --template $(yarn get-template << pipeline.parameters.workflow >> sandbox) --no-link --start-from=never --junit | ||
- report-workflow-on-failure: | ||
template: $(yarn get-template << pipeline.parameters.workflow >> sandbox) | ||
- persist_to_workspace: | ||
root: . | ||
paths: | ||
|
@@ -434,6 +461,8 @@ jobs: | |
- run: | ||
name: Smoke Testing Sandboxes | ||
command: yarn task --task smoke-test --template $(yarn get-template << pipeline.parameters.workflow >> smoke-test) --no-link --start-from=never --junit | ||
- report-workflow-on-failure: | ||
template: $(yarn get-template << pipeline.parameters.workflow >> smoke-test) | ||
- store_test_results: | ||
path: test-results | ||
build-sandboxes: | ||
|
@@ -453,6 +482,8 @@ jobs: | |
- run: | ||
name: Building Sandboxes | ||
command: yarn task --task build --template $(yarn get-template << pipeline.parameters.workflow >> build) --no-link --start-from=never --junit | ||
- report-workflow-on-failure: | ||
template: $(yarn get-template << pipeline.parameters.workflow >> build) | ||
- store_test_results: | ||
path: test-results | ||
- persist_to_workspace: | ||
|
@@ -476,6 +507,8 @@ jobs: | |
- run: | ||
name: Running Test Runner | ||
command: yarn task --task test-runner --template $(yarn get-template << pipeline.parameters.workflow >> test-runner) --no-link --start-from=never --junit | ||
- report-workflow-on-failure: | ||
template: $(yarn get-template << pipeline.parameters.workflow >> test-runner) | ||
- store_test_results: | ||
path: test-results | ||
chromatic-sandboxes: | ||
|
@@ -513,6 +546,8 @@ jobs: | |
- run: | ||
name: Running E2E Tests | ||
command: yarn task --task e2e-tests --template $(yarn get-template << pipeline.parameters.workflow >> e2e-tests) --no-link --start-from=never --junit | ||
- report-workflow-on-failure: | ||
template: $(yarn get-template << pipeline.parameters.workflow >> e2e-tests) | ||
- store_test_results: | ||
path: test-results | ||
- store_artifacts: # this is where playwright puts more complex stuff | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tr
andsed
are used to replace line breaks with literal\n
so they can display multiline results in discord: