检索在使用GitLab包注册表进行dotnet restore时出现的502错误。

huangapple go评论74阅读模式
英文:

Retrieve 502 errors during dotnet restore using gitlab package registry

问题

在运行 dotnet restore 过程中遇到了一些问题。我有一个GitLab私有包注册表,而在 dotnet restore 过程中,恢复期间出现了一堆502错误。看起来它试图从我的私有注册表获取外部依赖项。老实说,我不知道该怎么办。我感激任何帮助。谢谢!

日志片段:

  为源 'https://git.somedomain.com/api/v4/projects/22/packages/nuget/download/system.objectmodel/index.json' 重试 'FindPackagesByIdAsync'。
  响应状态代码表明失败: 502 (Bad Gateway)。
  为源 'https://git.somedomain.com/api/v4/projects/22/packages/nuget/download/messagepackanalyzer/index.json' 重试 'FindPackagesByIdAsync'。
  响应状态代码表明失败: 502 (Bad Gateway)。
  为源 'https://git.somedomain.com/api/v4/projects/22/packages/nuget/download/microsoft.win32.systemevents/index.json' 重试 'FindPackagesByIdAsync'。
  响应状态代码表明失败: 502 (Bad Gateway)。
  为源 'https://git.somedomain.com/api/v4/projects/22/packages/nuget/download/runtime.debian.8-x64.runtime.native.system.security.cryptography.openssl/index.json' 重试 'FindPackagesByIdAsync'。
  响应状态代码表明失败: 502 (Bad Gateway)。
  为源 'https://git.somedomain.com/api/v4/projects/22/packages/nuget/download/messagepack/index.json' 重试 'FindPackagesByIdAsync'。
  响应状态代码表明失败: 502 (Bad Gateway)。
  为源 'https://git.somedomain.com/api/v4/projects/22/packages/nuget/download/system.io.pipes/index.json' 重试 'FindPackagesByIdAsync'。
  响应状态代码表明失败: 502 (Bad Gateway)。
/builds/rvn/reports/ServerFace/ServerFace/ServerFace.csproj : 错误 NU1301: 无法从远程源 'https://git.somedomain.com/api/v4/projects/22/packages/nuget/download/runtime.fedora.23-x64.runtime.native.system.security.cryptography.openssl/index.json' 检索有关 'runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl' 的信息。 [/builds/rvn/reports/ServerFace/ServerFace.sln]
  为源 'https://git.somedomain.com/api/v4/projects/22/packages/nuget/download/system.security.principal.windows/index.json' 重试 'FindPackagesByIdAsync'。
  响应状态代码表明失败: 502 (Bad Gateway)。
/builds/rvn/reports/ServerFace/ServerFace/ServerFace.csproj : 错误 NU1301: 无法从远程源 'https://git.somedomain.com/api/v4/projects/22/packages/nuget/download/runtime.fedora.23-x64.runtime.native.system.security.cryptography.openssl/index.json' 检索有关 'runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl' 的信息。 [/builds/rvn/reports/ServerFace/ServerFace.sln]
/builds/rvn/reports/ServerFace/ServerFace/ServerFace.csproj : 错误 NU1301: 无法从远程源 'https://git.somedomain.com/api/v4/projects/22/packages/nuget/download/runtime.fedora.23-x64.runtime.native.system.security.cryptography.openssl/index.json' 检索有关 'runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl' 的信息。 [/builds/rvn/reports/ServerFace/ServerFace.sln]
/builds/rvn/reports/ServerFace/ServerFace/ServerFace.csproj : 错误 NU1301: 无法从远程源 'https://git.somedomain.com/api/v4/projects/22/packages/nuget/download/runtime.fedora.23-x64.runtime.native.system.security.cryptography.openssl/index.json' 检索有关 'runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl' 的信息。 [/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>
英文:

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

Nuget.conf:

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

答案1

得分: 0

我已找到我的解决方案。关键是,NuGet 依次遍历所有包源。因此,NuGet 尝试从所有源中查找所有依赖项。老实说,我不知道为什么我只从我的 GitLab 包注册表中看到 502 错误,而不是从 Nexus。无论如何,我的解决方案是使用包源映射 - 适合我。

英文:

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.

huangapple
  • 本文由 发表于 2023年7月6日 20:08:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/76628665.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定