From 726d37279dfe23266d292279bda804b9217a4138 Mon Sep 17 00:00:00 2001 From: "Geoffrey M. Oxberry" Date: Tue, 5 Nov 2024 08:20:52 -0800 Subject: [PATCH] [smp]: prevent empty regression detector comments If the Regression Detector fails to submit a job to SMP, an empty Regression Detector PR comment is posted to PRs. This empty comment is noise and undesirable, so this commit tests whether the Regression Detector generated a Markdown report before attempting to post. If the Markdown report does not exist, the Regression Detector PR comment will echo an error message and emit a non-zero exit code so that the PR comment job fails before posting. Signed-off-by: Geoffrey M. Oxberry --- .gitlab/functional_test/regression_detector.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitlab/functional_test/regression_detector.yml b/.gitlab/functional_test/regression_detector.yml index be6eeebb865df..3e3760f2917eb 100644 --- a/.gitlab/functional_test/regression_detector.yml +++ b/.gitlab/functional_test/regression_detector.yml @@ -35,7 +35,6 @@ single-machine-performance-regression_detector: script: # Ensure output files exist for artifact downloads step - mkdir outputs # Also needed for smp job sync step - - touch outputs/report.md # Will be emitted by smp job sync # Compute merge base of current commit and `main` - git fetch origin - SMP_BASE_BRANCH=$(inv release.get-release-json-value base_branch) @@ -158,6 +157,14 @@ single-machine-performance-regression_detector-pr-comment: FF_KUBERNETES_HONOR_ENTRYPOINT: false allow_failure: true # allow_failure here should have same setting as in job above script: # ignore error message about no PR, because it happens for dev branches without PRs + # Prevent posting empty Regression Detector report if Markdown report is not found or + # has zero size. + - | + if [[ ! -s "outputs/report.md" ]] + then + echo "ERROR: Regression Detector report not found -- no PR comment posted" + exit 1 + fi # We need to transform the Markdown report into a valid JSON string (without # quotes) in order to pass a well-formed payload to the PR commenting # service. Note that on macOS, the "-z" flag is invalid for `sed` (but