Search code examples
c#.netnugetgitlab-pages

Retrieve 502 errors during dotnet restore using gitlab package registry


Have some issue during running dotnet restore. I have GitLab private package registry, and during dotnet restore I have a bunch of 502 errors during restore. It seems that it tries to get external dependencies from my private registry. Honestly I do not know what to do. I appreciate any help. Thank you!

Piece of logs:

  Retrying 'FindPackagesByIdAsync' for source 'https://git.somedomain.com/api/v4/projects/22/packages/nuget/download/system.objectmodel/index.json'.
  Response status code does not indicate success: 502 (Bad Gateway).
  Retrying 'FindPackagesByIdAsync' for source 'https://git.somedomain.com/api/v4/projects/22/packages/nuget/download/messagepackanalyzer/index.json'.
  Response status code does not indicate success: 502 (Bad Gateway).
  Retrying 'FindPackagesByIdAsync' for source 'https://git.somedomain.com/api/v4/projects/22/packages/nuget/download/microsoft.win32.systemevents/index.json'.
  Response status code does not indicate success: 502 (Bad Gateway).
  Retrying 'FindPackagesByIdAsync' for source 'https://git.somedomain.com/api/v4/projects/22/packages/nuget/download/runtime.debian.8-x64.runtime.native.system.security.cryptography.openssl/index.json'.
  Response status code does not indicate success: 502 (Bad Gateway).
  Retrying 'FindPackagesByIdAsync' for source 'https://git.somedomain.com/api/v4/projects/22/packages/nuget/download/messagepack/index.json'.
  Response status code does not indicate success: 502 (Bad Gateway).
  Retrying 'FindPackagesByIdAsync' for source 'https://git.somedomain.com/api/v4/projects/22/packages/nuget/download/system.io.pipes/index.json'.
  Response status code does not indicate success: 502 (Bad Gateway).
/builds/rvn/reports/ServerFace/ServerFace/ServerFace.csproj : error NU1301: Failed to retrieve information about 'runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl' from remote source 'https://git.somedomain.com/api/v4/projects/22/packages/nuget/download/runtime.fedora.23-x64.runtime.native.system.security.cryptography.openssl/index.json'. [/builds/rvn/reports/ServerFace/ServerFace.sln]
  Retrying 'FindPackagesByIdAsync' for source 'https://git.somedomain.com/api/v4/projects/22/packages/nuget/download/system.security.principal.windows/index.json'.
  Response status code does not indicate success: 502 (Bad Gateway).
/builds/rvn/reports/ServerFace/ServerFace/ServerFace.csproj : error NU1301: Failed to retrieve information about 'runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl' from remote source 'https://git.somedomain.com/api/v4/projects/22/packages/nuget/download/runtime.fedora.23-x64.runtime.native.system.security.cryptography.openssl/index.json'. [/builds/rvn/reports/ServerFace/ServerFace.sln]
/builds/rvn/reports/ServerFace/ServerFace/ServerFace.csproj : error NU1301: Failed to retrieve information about 'runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl' from remote source 'https://git.somedomain.com/api/v4/projects/22/packages/nuget/download/runtime.fedora.23-x64.runtime.native.system.security.cryptography.openssl/index.json'. [/builds/rvn/reports/ServerFace/ServerFace.sln]
/builds/rvn/reports/ServerFace/ServerFace/ServerFace.csproj : error NU1301: Failed to retrieve information about 'runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl' from remote source 'https://git.somedomain.com/api/v4/projects/22/packages/nuget/download/runtime.fedora.23-x64.runtime.native.system.security.cryptography.openssl/index.json'. [/builds/rvn/reports/ServerFace/ServerFace.sln]

Nuget.conf:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <clear />
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
    <add key="NuGets Feed" value="https://nexus.somedomain.com/nexus/service/local/nuget/dotnet-packages/" />
    <add key="GitLab" value="https://git.somedomain.com/api/v4/projects/22/packages/nuget/index.json" />
  </packageSources>
  <packageSourceCredentials>
      <GitLab>
          <add key="Username" value="%GITLAB_PACKAGE_REGISTRY_USERNAME%" />
          <add key="ClearTextPassword" value="%GITLAB_PACKAGE_REGISTRY_PASSWORD%" />
      </GitLab>
  </packageSourceCredentials>
  <activePackageSource>
    <!-- this tells that all of them are active -->
    <add key="All" value="(Aggregate source)" />
  </activePackageSource>
</configuration>

Solution

  • Guess I have found my resolution. The point is, nuget goes through all package sources sequentially. So that nuget tries to find all dependencies from all sources. Honestly, I have no idea why I see 502 errors only from my gitlab package registry, but not from Nexus. Anyway, my solution is to use Package source mapping - fits to me.