-
Notifications
You must be signed in to change notification settings - Fork 1k
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
allow discovery to re-run if files are missing; log errors #11055
Conversation
@dependencies ||= T.let(begin | ||
NativeDiscoveryJsonReader.debug_report_discovery_files(error_if_missing: true) | ||
directory = source&.directory || "/" | ||
discovery_json_reader = NativeDiscoveryJsonReader.run_discovery_in_directory( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method will return the existing discovery JSON if it exists from the previous run, or run it again if required.
"#{File.read(discovery_map_file_path)}") | ||
Dependabot.logger.info("Discovery files: #{Dir.glob(File.join(discovery_directory, '*'))}") | ||
elsif error_if_missing | ||
Dependabot.logger.error("discovery map file missing") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows PR creation to continue, but will make a handy search point in the logs.
@@ -7,5 +7,19 @@ echo "NuGet native updater experiment value: $nuget_experiment_value" | |||
if echo "$nuget_experiment_value" | grep -q 'true'; then | |||
pwsh "$DEPENDABOT_HOME/dependabot-updater/bin/main.ps1" $* | |||
else | |||
operation=$1 | |||
dot_dependabot_directory="$DEPENDABOT_HOME/.dependabot" | |||
discovery_map_path="$dot_dependabot_directory/discovery_map.json" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These checks are just to see what exists on disk before and after the processes are started/ended to help narrow down when and where the files are getting deleted.
Despite a recent PR, it still seems possible for the discovery JSON files to go missing between
fetch_files
andupdate_files
.This PR allows the update job to continue by re-running discovery if necessary, but also logs in several locations what discovery files were produced so we can hopefully figure out where they're going. Re-running discovery is faster the second time because packages have already been downloaded and only adds 30s or so to the update.
I manually verified the re-run behavior works by manually deleting the discovery JSON files between
fetch_files
andupdate_files
and the appropriate errors were reported and discovery was re-run and the update job completed as expected.