Pester icon indicating copy to clipboard operation
Pester copied to clipboard

Cache nugets in CI

Open nohwnd opened this issue 3 years ago • 1 comments

Fix #2202

nohwnd avatar Jun 30 '22 09:06 nohwnd

Https certs are still installed even with that env variable in place. Not sure why.

I had problems with hashes not matching, and had the delete selected folders from my nuget cache to be able to build on CI and locally, apparently the local nuget was "outdated" and had different hash but the same version, no idea why, but I found it mentioned in few places. If this turns out to be a big problem we can set nuget to restore to cache folder that is specific to Pester.

nohwnd avatar Jul 01 '22 09:07 nohwnd

Perfect and now it failed :D Can't investigate right now.

nohwnd avatar Oct 03 '22 07:10 nohwnd

Close/Reopened to trigger fresh CI-run

fflaten avatar Oct 25 '22 18:10 fflaten

Gave it shot.

  1. We always restore in build.ps1, so I removed the nuget restore step to avoid having two restore-commands with potential conflict.
  2. Then it complained about SMA 6.1.0 -> 6.0.4 dep. change which is correct. Merged main + updated lock file
  3. Now Pester-project works, but PesterTests fails with a even more confusing error
Restored D:\a\1\s\src\csharp\Pester\Pester.csproj (in 10.2 sec).
D:\a\1\s\src\csharp\PesterTests\PesterTests.csproj : error NU1102: Unable to find package NETStandard.Library with version (>= 1.6.1) [D:\a\1\s\src\csharp\Pester.sln]
D:\a\1\s\src\csharp\PesterTests\PesterTests.csproj : error NU1102:   - Found 10 version(s) in nuget.org [ Nearest version: 1.6.1 ] [D:\a\1\s\src\csharp\Pester.sln]
D:\a\1\s\src\csharp\PesterTests\PesterTests.csproj : error NU1102:   - Found 3 version(s) in Microsoft Visual Studio Offline Packages [ Nearest version: 1.6.1 ] [D:\a\1\s\src\csharp\Pester.sln]

Which is it, a match or not? 🤷‍♂️

Because I generated lock file on ubuntu while CI is Windows? Try changing to windows-2022 (.NET 6) for build image? Update: Submitted #2249

fflaten avatar Oct 25 '22 20:10 fflaten

Yeah the errors are confusing.

nohwnd avatar Oct 26 '22 08:10 nohwnd

@fflaten I merged the other PR if you want to have another look.

nohwnd avatar Oct 26 '22 09:10 nohwnd

The HTTPS certificate isn't created after all. It's just a hardcoded text in a first run string, see https://github.com/dotnet/sdk/issues/12195#issuecomment-662159293. Verified in another pipeline using dotnet dev-certs https --check after dotnet restore.

We can hide the remaining HTTPS + ASP messages using DOTNET_NOLOGO and just log the current SDK.

fflaten avatar Oct 26 '22 11:10 fflaten