forked from etcd-io/etcd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scripts: add script to measure percentage of commits with failed status
This is to start measuring the test flakyness and see the numbers improving once we improve and deflake flaky tests Fixes etcd-io#13167
- Loading branch information
1 parent
af9b5e7
commit b447aaf
Showing
2 changed files
with
23 additions
and
1 deletion.
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
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set -o pipefail | ||
|
||
if [[ -z ${GITHUB_TOKEN} ]] | ||
then | ||
echo "Please set the \$GITHUB_TOKEN environment variable for the script to work" | ||
exit 1 | ||
fi | ||
|
||
curl --fail --show-error --silent -H "Authorization: token ${GITHUB_TOKEN}" \ | ||
-X POST \ | ||
-d '{ | ||
"query": "query { repository(owner: \"etcd-io\", name: \"etcd\") { defaultBranchRef { target { ... on Commit { history(first: 100) { edges { node { ... on Commit { commitUrl statusCheckRollup { state } } } } } } } } } }" | ||
}' \ | ||
https://api.github.com/graphql | jq . > commit-and-check-data.json | ||
|
||
failure_percentage=$(jq '.data.repository.defaultBranchRef.target.history.edges | reduce .[] as $item (0; if $item.node.statusCheckRollup.state == "FAILURE" then (. + 1) else . end)' commit-and-check-data.json) | ||
|
||
echo "Commit status failure percentage is - ${failure_percentage} %" |