Search code examples
.netdockernugetgitlab-cimaui

Since dotnet/sdk:8.0, dotnet restore takes too long on gitlab ci with docker


I have upgraded my docker dotnet image to dotnet/sdk:8.0 to build MAUI projects on my Gitlab CI with docker runners.

But now the job takes like 40 minutes to restore the projects (before: 45 seconds):

$ dotnet restore --no-cache
Restored /builds/**/A.csproj (in 10.11 min).
Restored /builds/**/B.csproj (in 14.13 min).
Restored /builds/**/C.csproj (in 2.03 min).
Restored /builds/**/D.csproj (in 36.08 min).

The ops in charge of the runners tells me that the CPU usage was above 100%.

I have no problem restoring the project on my local machine.

Anyone has already faced this issue after upgrading to .Net 8?


Solution

  • For other people facing the same issue, this can be fixed by a workaround proposed by NuGet team: https://github.com/NuGet/Home/issues/13062

    Solution: Set environment variable DOTNET_NUGET_SIGNATURE_VERIFICATION to false.

    Explanation: In .Net 8 the NuGet tool tries to verify all package signatures by default. If you are behind a firewall, this can lead to many hidden timeouts.