From 031f3331e7a81ec282e4abad9debf4ac7acaf679 Mon Sep 17 00:00:00 2001 From: Andriy Dzikh Date: Thu, 15 Jul 2021 10:54:43 -0700 Subject: [PATCH 1/5] Fix flake report script badly formatted. --- hack/jenkins/test-flake-chart/report_flakes.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hack/jenkins/test-flake-chart/report_flakes.sh b/hack/jenkins/test-flake-chart/report_flakes.sh index 9040a71577..2be76ea237 100755 --- a/hack/jenkins/test-flake-chart/report_flakes.sh +++ b/hack/jenkins/test-flake-chart/report_flakes.sh @@ -39,10 +39,10 @@ TMP_DATA=$(mktemp) # 2) Filter tests to only include failed tests (and only get their names and environment). # 3) Sort by environment, then test name. # 4) Store in file $TMP_DATA. -gsutil cat $(< "${ENVIRONMENT_LIST}" sed -r "s/^/gs:\\/\\/minikube-builds\\/logs\\/${PR_NUMBER}\\/${SHORT_COMMIT}\\/; s/$/_summary.json/") \ +gsutil cat $(< "${ENVIRONMENT_LIST}" sed -r "s/^/gs:\\/\\/minikube-builds\\/logs\\/${PR_NUMBER}\\/${SHORT_COMMIT}\\//; s/$/_summary.json/") \ | "$DIR/process_data.sh" \ | sed -n -r -e "s/[0-9a-f]*,[0-9-]*,([a-zA-Z\/_0-9-]*),([a-zA-Z\/_0-9-]*),Failed,[.0-9]*/\1:\2/p" \ - | sort -t, -k\ + | sort -t: -k1,1 -k2,2 \ > "$TMP_DATA" # Download the precomputed flake rates from the GCS bucket into file $TMP_FLAKE_RATES. From 0fe08d715d33f35b754657832e7ad9c0d903db59 Mon Sep 17 00:00:00 2001 From: Andriy Dzikh Date: Thu, 15 Jul 2021 14:26:02 -0700 Subject: [PATCH 2/5] Install jq on machines when running sync_tests.sh. --- hack/jenkins/test-flake-chart/sync_tests.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hack/jenkins/test-flake-chart/sync_tests.sh b/hack/jenkins/test-flake-chart/sync_tests.sh index 03b4cf364a..76fe8d264e 100644 --- a/hack/jenkins/test-flake-chart/sync_tests.sh +++ b/hack/jenkins/test-flake-chart/sync_tests.sh @@ -75,6 +75,9 @@ echo "${FINISHED_LIST_JOINED}" > ${FINISHED_LIST} # Get directory of this script. DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +# Ensure jq is installed on this machine. +sudo apt-get install jq -y + if [[ "${MINIKUBE_LOCATION}" == "master" ]]; then for ENVIRONMENT in ${STARTED_LIST}; do SUMMARY="${BUCKET_PATH}/${ENVIRONMENT}_summary.json" From 3d29731932789ab18765efc3b3e0908f3cec44c4 Mon Sep 17 00:00:00 2001 From: Andriy Dzikh Date: Fri, 16 Jul 2021 09:33:32 -0700 Subject: [PATCH 3/5] ls gopogh reports first to ensure they are valid, then cat the valid ones together. --- hack/jenkins/test-flake-chart/report_flakes.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/hack/jenkins/test-flake-chart/report_flakes.sh b/hack/jenkins/test-flake-chart/report_flakes.sh index 2be76ea237..ec7e2749c9 100755 --- a/hack/jenkins/test-flake-chart/report_flakes.sh +++ b/hack/jenkins/test-flake-chart/report_flakes.sh @@ -35,14 +35,19 @@ MAX_REPORTED_TESTS=30 DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) TMP_DATA=$(mktemp) -# 1) Process the data in each gopogh summary. -# 2) Filter tests to only include failed tests (and only get their names and environment). -# 3) Sort by environment, then test name. -# 4) Store in file $TMP_DATA. -gsutil cat $(< "${ENVIRONMENT_LIST}" sed -r "s/^/gs:\\/\\/minikube-builds\\/logs\\/${PR_NUMBER}\\/${SHORT_COMMIT}\\//; s/$/_summary.json/") \ +# 1) Process the ENVIRONMENT_LIST to turn them into valid GCS URLs. +# 2) Check to see if the files are present. Ignore any missing files. +# 3) Cat the gopogh summaries together. +# 4) Process the data in each gopogh summary. +# 5) Filter tests to only include failed tests (and only get their names and environment). +# 6) Sort by environment, then test name. +# 7) Store in file $TMP_DATA. +< "${ENVIRONMENT_LIST}" sed -r "s/^/gs:\\/\\/minikube-builds\\/logs\\/${PR_NUMBER}\\/${SHORT_COMMIT}\\//; s/$/_summary.json/" \ + | (xargs gsutil ls || true) \ + | xargs gsutil cat \ | "$DIR/process_data.sh" \ | sed -n -r -e "s/[0-9a-f]*,[0-9-]*,([a-zA-Z\/_0-9-]*),([a-zA-Z\/_0-9-]*),Failed,[.0-9]*/\1:\2/p" \ - | sort -t: -k1,1 -k2,2 \ + | sort \ > "$TMP_DATA" # Download the precomputed flake rates from the GCS bucket into file $TMP_FLAKE_RATES. From 7ca1ce55d0c39f169f8ac07242224275c5204c11 Mon Sep 17 00:00:00 2001 From: Andriy Dzikh Date: Sat, 17 Jul 2021 14:54:42 -0700 Subject: [PATCH 4/5] No longer use non-existent ENVIRONMENT variable. --- hack/jenkins/test-flake-chart/report_flakes.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hack/jenkins/test-flake-chart/report_flakes.sh b/hack/jenkins/test-flake-chart/report_flakes.sh index ec7e2749c9..6884a82251 100755 --- a/hack/jenkins/test-flake-chart/report_flakes.sh +++ b/hack/jenkins/test-flake-chart/report_flakes.sh @@ -74,7 +74,7 @@ fi # Create the comment template. TMP_COMMENT=$(mktemp) -printf "These are the flake rates of all failed tests per %s.\n|Environment|Failed Tests|Flake Rate (%%)|\n|---|---|---|\n" "$ENVIRONMENT" > "$TMP_COMMENT" +printf "These are the flake rates of all failed tests.\n|Environment|Failed Tests|Flake Rate (%%)|\n|---|---|---|\n" > "$TMP_COMMENT" # 1) Get the first $MAX_REPORTED_TESTS lines. # 2) Print a row in the table with the environment, test name, flake rate, and a link to the flake chart for that test. # 3) Append these rows to file $TMP_COMMENT. @@ -87,7 +87,7 @@ if [[ "$FAILED_RATES_LINES" -gt 30 ]]; then printf "|More tests...|Continued...|\n\nToo many tests failed - See test logs for more details." >> "$TMP_COMMENT" fi -printf "\n\nTo see the flake rates of all tests on $ENVIRONMENT, click [here](https:\/\/storage.googleapis.com\/minikube-flake-rate\/flake_chart.html?env=$ENVIRONMENT)." >> "$TMP_COMMENT" +printf "\n\nTo see the flake rates of all tests by environment, click [here](https://minikube.sigs.k8s.io/docs/contrib/test_flakes/)." >> "$TMP_COMMENT" # install gh if not present "$DIR/../installers/check_install_gh.sh" From 6176111a5c89405cba2be8f3ba84c0e4c3623030 Mon Sep 17 00:00:00 2001 From: Andriy Dzikh Date: Mon, 19 Jul 2021 13:40:41 -0700 Subject: [PATCH 5/5] Add link to environment pages to flake rate comments. --- hack/jenkins/test-flake-chart/report_flakes.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hack/jenkins/test-flake-chart/report_flakes.sh b/hack/jenkins/test-flake-chart/report_flakes.sh index 6884a82251..8662e750dd 100755 --- a/hack/jenkins/test-flake-chart/report_flakes.sh +++ b/hack/jenkins/test-flake-chart/report_flakes.sh @@ -79,7 +79,7 @@ printf "These are the flake rates of all failed tests.\n|Environment|Failed Test # 2) Print a row in the table with the environment, test name, flake rate, and a link to the flake chart for that test. # 3) Append these rows to file $TMP_COMMENT. < "$TMP_FAILED_RATES" head -n $MAX_REPORTED_TESTS \ - | sed -n -r -e "s/([a-zA-Z\/0-9_-]*):([a-zA-Z\/0-9_-]*),([.0-9]*)/|\1|\2|\3 ([chart](https:\/\/storage.googleapis.com\/minikube-flake-rate\/flake_chart.html?env=\1\&test=\2))|/p" \ + | sed -n -r -e "s/([a-zA-Z\/0-9_-]*):([a-zA-Z\/0-9_-]*),([.0-9]*)/|[\1](https:\/\/storage.googleapis.com\/minikube-flake-rate\/flake_chart.html?env=\1))|\2|\3 ([chart](https:\/\/storage.googleapis.com\/minikube-flake-rate\/flake_chart.html?env=\1\&test=\2))|/p" \ >> "$TMP_COMMENT" # If there are too many failing tests, add an extra row explaining this, and a message after the table.