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

allow discovery to re-run if files are missing; log errors #11055

Merged
merged 1 commit into from
Dec 5, 2024

Conversation

brettfo
Copy link
Contributor

@brettfo brettfo commented Dec 4, 2024

Despite a recent PR, it still seems possible for the discovery JSON files to go missing between fetch_files and update_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 and update_files and the appropriate errors were reported and discovery was re-run and the update job completed as expected.

@brettfo brettfo requested a review from a team as a code owner December 4, 2024 22:09
@github-actions github-actions bot added the L: dotnet:nuget NuGet packages via nuget or dotnet label Dec 4, 2024
@dependencies ||= T.let(begin
NativeDiscoveryJsonReader.debug_report_discovery_files(error_if_missing: true)
directory = source&.directory || "/"
discovery_json_reader = NativeDiscoveryJsonReader.run_discovery_in_directory(
Copy link
Contributor Author

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")
Copy link
Contributor Author

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"
Copy link
Contributor Author

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.

@randhircs randhircs merged commit 10033ae into main Dec 5, 2024
80 checks passed
@randhircs randhircs deleted the dev/brettfo/nuget-rerun-discovery branch December 5, 2024 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: dotnet:nuget NuGet packages via nuget or dotnet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants