Commit 1143cc4b authored by Robert Marshall's avatar Robert Marshall Committed by DJ Mountney
Browse files

Patch netfetcher to debug download errors

- Adds debugging information when downloads checksum validation fails
  allowing better troubleshooting of S3 cache failures

Related https://gitlab.com/gitlab-org/distribution/team-tasks/-/issues/351

Signed-off-by: Robert Marshall's avatarRobert Marshall <rmarshall@gitlab.com>
parent 746ae7a7
......@@ -82,11 +82,22 @@ module Omnibus
else
file = URI.open(from_url, options)
end
# debugging for failed downloads
debug_data = {
"content_type": file.content_type,
"metadata": file.metas,
"status": file.status,
"redirected_uri": file.base_uri
}
# This is a temporary file. Close and flush it before attempting to copy
# it over.
file.close
FileUtils.cp(file.path, to_path)
file.unlink
debug_data
rescue SocketError,
Errno::ECONNREFUSED,
Errno::ECONNRESET,
......
......@@ -83,8 +83,17 @@ module Omnibus
log.info(log_key) { "Downloading from `#{download_url}'" }
create_required_directories
download
debug_data = download
verify_checksum!
rescue ChecksumMismatch => original_error
debug_msg = <<-MSG_TEXT
Detected checksum mismatch.
DEBUGGING INFO FROM DOWNLOAD
#{debug_data}
MSG_TEXT
log.info(log_key) { debug_msg }
raise original_error
end
#
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment