Rya*_*mas 5 azure-pipelines azure-artifacts
我今天遇到了一个随机发生的问题,即我的所有 DevOps Pipelines 无法再访问我的 NuGet feed,这是一个 DevOps Artifact。
我有一个任务负责安装 AzureSignTool,下面是该任务的 YAML。windows-latest我正在Microsoft 托管代理上使用该图像。
- task: CmdLine@2
displayName: 'Install AzureSignTool'
inputs:
script: |
set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
dotnet tool install --global AzureSignTool --version 4.0.1
Run Code Online (Sandbox Code Playgroud)
这是因以下错误而失败的任务。
未处理的异常:NuGet.Protocol.Core.Types.FatalProtocolException:无法加载 source 的服务索引。---> System.Net.Http.HttpRequestException:响应状态代码不表示成功:401(未经授权)。
我已经检查了提要的权限,并且可以确认它们Project\Build Administrators已设置为所有者。
我还尝试了各种其他操作,包括更改代理上的 NuGet 版本、更改 AzureSignTool 的版本等。
我应该检查哪些权限/设置?
因此,我将 RestoreNuGetPackages 任务移到 InstallAzureSignTool 之前,并且该任务成功,因此显然它可以毫无问题地进行身份验证。
然而任务仍然失败。我什至添加了--ignore-failed-sources但这没有效果。
错误消息已更改,但根本问题是相同的。
[NuGet Manager] [Info] GET https://api.nuget.org/v3/registration5-gz-semver2/azuresigntool/index.json
[NuGet Manager] [Info] GET https://{ORG}.pkgs.visualstudio.com/_packaging/{GUID}/nuget/v3/registrations2-semver2/azuresigntool/index.json
[NuGet Manager] [Info] Unauthorized https://{ORG}.pkgs.visualstudio.com/_packaging/{GUID}/nuget/v3/registrations2-semver2/azuresigntool/index.json 767ms
[NuGet Manager] [Info] OK https://api.nuget.org/v3/registration5-gz-semver2/azuresigntool/index.json 1010ms
Unhandled exception: System.Net.Http.HttpRequestException: Response status code does not indicate success: 401 (Unauthorized).
at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
Run Code Online (Sandbox Code Playgroud)
将映像从 切换windows-latest到windows-2019已经解决了问题,因此 Microsoft 对最新映像所做的任何更改都是有问题的。然而,这不是一个理想的解决方案,因为我们在项目文件中有 TextTransform 的 VS2022 路径,因此构建会在稍后的过程中失败。
我如何向 Microsoft 的相应团队提出此问题?
我也突然遇到问题了 也许这可以帮助别人。我在 10 号启动了一个构建,它运行得很好,然后我昨天运行了一个构建,但它失败了,即使我没有更改代码或设置更改。
我的问题是:无法加载源的服务索引。这是由于对 nuget.config 中指定的 URL 进行未经授权的访问所致,因为发布任务中发生的隐式还原无法访问授权的源。(很奇怪,因为它之前可以工作。)尽管如此,我确实注意到最近有一个更改被推送到我正在使用的虚拟机映像(Windows-最新)。
我的解决方法是向发布任务添加 --no-restore 参数,并在发布任务之前添加显式恢复任务。现在构建得很好。
这就是这两个步骤现在的样子。
- task: DotNetCoreCLI@2
inputs:
command: 'restore'
projects: '**/*.csproj'
feedsToUse: 'select'
vstsFeed: '{yourFeed}'
- task: DotNetCoreCLI@2
displayName: 'Publish Artifact: {websiteName}'
inputs:
command: 'publish'
publishWebProjects: true
arguments: '--no-restore'
Run Code Online (Sandbox Code Playgroud)
这是我之前的情况:
- task: DotNetCoreCLI@2
displayName: 'Publish Artifact: {websiteName}'
inputs:
command: 'publish'
publishWebProjects: true
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1466 次 |
| 最近记录: |