Skip to content

Commit

Permalink
Fail with 255 in case of exception
Browse files Browse the repository at this point in the history
Signed-off-by: eduponz <[email protected]>
  • Loading branch information
EduPonz committed Jun 14, 2024
1 parent d1ad2db commit 1685099
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
30 changes: 18 additions & 12 deletions resources/flakiness_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,25 @@ def parse_options() -> argparse.Namespace:

if __name__ == "__main__":

args = parse_options()
try:
args = parse_options()

archive = FlakyTestsArchive(
args.junit_archive,
args.window_size,
args.delete_old_files
)
archive = FlakyTestsArchive(
args.junit_archive,
args.window_size,
args.delete_old_files
)

if args.markdown_file:
FlakyTestsMdPublisher.publish(archive, args.markdown_file)

if args.markdown_file:
FlakyTestsMdPublisher.publish(archive, args.markdown_file)
if args.json_file:
FlakyTestsJSONPublisher.publish(archive, args.json_file)

if args.json_file:
FlakyTestsJSONPublisher.publish(archive, args.json_file)
ret = 0 if archive.flaky_test_count == 0 else 1
exit(ret)

ret = 0 if archive.flaky_test_count == 0 else 1
exit(ret)
except Exception as e:
# Exit with 255 error so that the action can fail
print(e)
exit(255)
3 changes: 2 additions & 1 deletion ubuntu/flakiness_report/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ runs:
echo "Flakiness report generated"
if [[ "${{ inputs.fail_on_flaky_tests }}" != "True" ]]
# A 255 exit code indicates that an exception occurred in the script, we want to fail in that case
if [ "${{ inputs.fail_on_flaky_tests }}" != "True" ] && [ "$EXIT_CODE" != "255" ]
then
echo "Ignoring flaky tests failures"
EXIT_CODE=0
Expand Down
4 changes: 3 additions & 1 deletion windows/flakiness_report/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ runs:
$EXIT_CODE = $LASTEXITCODE
if ("${{ inputs.fail_on_flaky_tests }}" -ne "True") {
# A 255 exit code indicates that an exception occurred in the script, we want to fail in that case
if ("${{ inputs.fail_on_flaky_tests }}" -ne "True" -and $EXIT_CODE -ne 255) {
Write-Output "Ignoring flaky tests failures"
$EXIT_CODE = 0
}
Expand Down

0 comments on commit 1685099

Please sign in to comment.