-
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
use unique directory for temp nuget packages #10243
Conversation
ec13581
to
6849322
Compare
@@ -37,12 +37,23 @@ public NuGetContext(string? currentDirectory = null, ILogger? logger = null) | |||
.Where(p => p.IsEnabled) | |||
.ToImmutableArray(); | |||
Logger = logger ?? NullLogger.Instance; | |||
TempPackageDirectory = Path.Combine(Path.GetTempPath(), ".dependabot", "packages"); | |||
TempPackageDirectory = Path.Combine(Path.GetTempPath(), $"dependabot-packages_{Guid.NewGuid():d}"); |
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.
Since most of the other files generated during a run are under {temp}/.dependabot
, why move these out?
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.
I was seeing cases of flaky tests. With the re-used directory and a lot of test packages being named "Some.Package/1.0.0" there could be some overlap if a previous test left a package in this directory that didn't match what the next test exepcted (e.g., different target framework, etc.), especially with the lazy downloading behavior.
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.
☝️ might indicate a code comment would be useful to say "here's why we're doing this"
Some CI runs fail due to a corrupted temporary NuGet package. I can't get this to fail locally, but it seems to have a~30% failure rate in CI. The temp directory is re-used between tests and I'm exploring a theory that one test writes a corrupt package and the next test reads that. This PR uses a unique directory each time. I'll be running CI repeatedly to see if I can get it to fail.
I've run the NuGet leg of the CI 10 times with no failures. I'm good to call this ready.