Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add checks for querying remote end points in case of network errors. #429

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions _plugins/rosindex_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@ def update_local(site, repo_instances)
next
end

puts "Updating repo / instance "+repo.name+" / "+repo.id+" from uri: "+repo.uri

# open or initialize this repo
local_path = File.join(@checkout_path, repo_instances.name, id)

puts "Updating repo / instance "+repo.name+" / "+repo.id+" from uri: "+repo.uri+" into path: "+local_path

# make sure there's an actual uri
unless repo.uri
raise IndexException.new("No URI for repo instance " + id, id)
Expand Down Expand Up @@ -229,7 +229,19 @@ def map_build_result_to_icon(build_result)
def get_ci_data(distro, package_name, repo_name)
ci_data = Hash.new
manifest_url = "/#{DEFAULT_LANGUAGE_PREFIX}/#{distro}/api/#{package_name}/manifest.yaml"
manifest_response = Net::HTTP.get_response('docs.ros.org', manifest_url)
begin
manifest_response = Net::HTTP.get_response('docs.ros.org', manifest_url)
rescue StandardError => e
puts " Failed to fetch manifest from #{manifest_url} with error #{e.class}"
ci_data['tooltip'] = 'Error fetching CI information available for this package.'
ci_data['ci_available'] = false
return ci_data
rescue
puts " Failed to fetch manifest from #{manifest_url} with unknown error"
ci_data['tooltip'] = 'Error fetching CI information available for this package.'
ci_data['ci_available'] = false
return ci_data
end
if manifest_response.code != '200'
ci_data['tooltip'] = 'No CI information available for this package.'
ci_data['ci_available'] = false
Expand All @@ -250,7 +262,15 @@ def get_ci_data(distro, package_name, repo_name)
ci_data['job_url'] = manifest_yaml['devel_jobs'][0]
# get additional test information if available
results_url = "/#{DEFAULT_LANGUAGE_PREFIX}/#{distro}/devel_jobs/#{repo_name}/results.yaml"
results_response = Net::HTTP.get_response('docs.ros.org', results_url)
begin
results_response = Net::HTTP.get_response('docs.ros.org', results_url)
rescue
ci_data['tooltip'] = "Latest build information: " + ci_data['timestamp'] + "\n" \
'No test statistics available for this package.'
ci_data['result'] = 'success'
ci_data['stats_available'] = false
return ci_data
end
if results_response.code != '200'
ci_data['tooltip'] = "Latest build information: " + ci_data['timestamp'] + "\n" \
'No test statistics available for this package.'
Expand Down
Loading