Skip to content

Allow PipelineTestReportBuilder to handle missing test reports

Brian Williams requested to merge bwill/ignore-expired-artifacts into master

What does this MR do and why?

Describe in detail what your merge request does and why.

If pipeline artifacts have expired, then detect-previous-failed-tests will encounter Net::HTTPServerException when trying to retrieve them and the job will fail. Example: https://gitlab.com/gitlab-org/gitlab/-/jobs/2674966554

Click here to expand snippet of job failure
$ source ./scripts/rspec_helpers.sh
$ retrieve_previous_failed_tests ${PREVIOUS_FAILED_TESTS_DIR} "${RSPEC_PG_REGEX}" "${RSPEC_EE_PG_REGEX}"
Attempting to build pipeline test report...
/usr/local/lib/ruby/2.7.0/net/http/response.rb:124:in `error!': 404 "Not Found" (Net::HTTPServerException)
	from /usr/local/lib/ruby/2.7.0/net/http/response.rb:133:in `value'
	from scripts/pipeline_test_report_builder.rb:117:in `block (2 levels) in fetch'
	from /usr/local/lib/ruby/2.7.0/net/http.rb:1537:in `block in transport_request'
	from /usr/local/lib/ruby/2.7.0/net/http/response.rb:167:in `reading_body'
	from /usr/local/lib/ruby/2.7.0/net/http.rb:1536:in `transport_request'
	from /usr/local/lib/ruby/2.7.0/net/http.rb:1492:in `request'
	from scripts/pipeline_test_report_builder.rb:112:in `block in fetch'
	from /usr/local/lib/ruby/2.7.0/net/http.rb:933:in `start'
	from /usr/local/lib/ruby/2.7.0/net/http.rb:606:in `start'
	from scripts/pipeline_test_report_builder.rb:111:in `fetch'
	from scripts/pipeline_test_report_builder.rb:74:in `test_report_for_build'
	from scripts/pipeline_test_report_builder.rb:95:in `block in build_test_report_json_for_pipeline'
	from scripts/pipeline_test_report_builder.rb:94:in `each'
	from scripts/pipeline_test_report_builder.rb:94:in `build_test_report_json_for_pipeline'
	from scripts/pipeline_test_report_builder.rb:30:in `test_report_for_latest_pipeline'
	from scripts/pipeline_test_report_builder.rb:39:in `block in execute'
	from scripts/pipeline_test_report_builder.rb:38:in `open'
	from scripts/pipeline_test_report_builder.rb:38:in `execute'
	from scripts/pipeline_test_report_builder.rb:152:in `<main>'
URL: https://gitlab.com/api/v4/projects/gitlab-org%2Fgitlab/merge_requests/89171/pipelines
Discovered last failed pipeline (554525011) for MR!89171
URL: https://gitlab.com/api/v4/projects/278964/pipelines/554525011/jobs?scope=failed&per_page=100
3 failed builds in test stage found...
URL: https://gitlab.com/gitlab-org/gitlab/-/pipelines/554525011/tests/suite.json?build_ids[]=2540414313
Cleaning up project directory and file based variables 00:01
ERROR: Job failed: exit code 1

This MR updates PipelineTestReportBuilder so that it will continue executing when encountering 404 errors. The previously failed tests will eventually be run as part of the full test suite.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Michael Kozono

Merge request reports

Loading