【问题标题】:OctopusDeploy: Create release step fails with error "feed returned an unexpected status code '403 '"OctopusDeploy:创建发布步骤失败并出现错误“提要返回了意外的状态代码 '403'”
【发布时间】:2019-06-26 21:26:11
【问题描述】:

我有一个 TeamCity/OctopusDeploy 集成,以前可以正常工作,但在配置中没有任何更改的情况下突然失败。

唯一改变的是 TeamCity 和 OctopusDeploy 都同时更新了。有谁知道是什么原因造成的,我该如何解决?

这是最后一次成功构建的日志:

Step 5/5: OctopusDeploy: Create release (22s)
[Step 5/5] Octopus Deploy (21s)
[Octopus Deploy] Running command: octo.exe create-release --server http://localhost:8888/octopus --apikey SECRET --project Test Configuration Dev --enableservicemessages --version 0.0.0-develop.10 --deployto Test Environment --progress --package DemoFetcher:0.0.0-develop.10
[Octopus Deploy] Creating Octopus Deploy release
[Octopus Deploy] Octopus Deploy Command Line Tool, version 5.2.6
[Octopus Deploy] 
[Octopus Deploy] Detected automation environment: "TeamCity/2018.2.4"
[Octopus Deploy] Space name unspecified, process will run in the default space context
[Octopus Deploy] Handshaking with Octopus Server: http://localhost:8888/octopus
[Octopus Deploy] Handshake successful. Octopus version: 2019.3.1; API version: 3.0.0
[Octopus Deploy] Authenticated as: Admin <admin@company.com> 
[Octopus Deploy] This Octopus Server supports channels
[Octopus Deploy] Finding project: Test Configuration Dev
[Octopus Deploy] Automatically selecting the best channel for this release...
[Octopus Deploy] Building a release plan for Channel 'Default'...
[Octopus Deploy] Finding deployment process...
[Octopus Deploy] Finding release template...
[Octopus Deploy] The package version for some steps was not specified. Going to try and resolve those automatically...
[Octopus Deploy] Finding latest package for step: Install Company Test App Config Service
[Octopus Deploy] Selected 'TestApp.test' version '0.0.0-develop.10' for 'Install Company Test App Config Service'
[Octopus Deploy] Selected the release plan for Channel 'Default' - it is a perfect match
[Octopus Deploy] Using version number provided on command-line: 0.0.0-develop.10
[Octopus Deploy] Release plan for Test Configuration Dev 0.0.0-develop.10
[Octopus Deploy] Channel: 'Default' (this is the default channel)
[Octopus Deploy] # Name Version Source Version rules 
[Octopus Deploy] --- ------------------------------------------------------- ------------------ ------------------ -------------------
[Octopus Deploy] 1 Install Company Test App Config Service 0.0.0-develop.10 Latest available Allow any version 
[Octopus Deploy] 
[Octopus Deploy] Creating release...
[Octopus Deploy] Release 0.0.0-develop.10 created successfully!
[Octopus Deploy] ##teamcity[setParameter name='octo.releaseNumber' value='0.0.0-develop.10']
[Octopus Deploy] Deploying Test Configuration Dev "0.0.0-develop.10" to: Test Environment (Guided Failure: Not Enabled)
[Octopus Deploy] Waiting for 1 deployment(s) to complete....
[Octopus Deploy] Success: Acquire packages
[Octopus Deploy] Success: Step 2: Install Company Test App Config Service
[Octopus Deploy] Success: Apply retention policy on Tentacles
[Octopus Deploy] Deploy Test Configuration Dev release 0.0.0-develop.10 to Test Environment: Success
[Octopus Deploy] Done!
[Octopus Deploy] Octo.exe exit code: 0

相比之下,这是第一次失败构建的日志:

Step 6/6: OctopusDeploy: Create release (2s)
[Step 6/6] Octopus Deploy (1s)
[Octopus Deploy] Running command: octo.exe create-release --server http://localhost:8888/octopus --apikey SECRET --project Test Configuration Dev --enableservicemessages --version 0.0.0-develop.17 --deployto Test Environment --progress --package DemoFetcher:0.0.0-develop.17
[Octopus Deploy] Creating Octopus Deploy release
[Octopus Deploy] Octopus Deploy Command Line Tool, version 5.2.6
[Octopus Deploy] 
[Octopus Deploy] Detected automation environment: "TeamCity/2019.1"
[Octopus Deploy] Space name unspecified, process will run in the default space context
[Octopus Deploy] Handshaking with Octopus Server: http://localhost:8888/octopus
[Octopus Deploy] Handshake successful. Octopus version: 2019.3.3; API version: 3.0.0
[Octopus Deploy] Authenticated as: Admin <admin@company.com> 
[Octopus Deploy] This Octopus Server supports channels
[Octopus Deploy] Finding project: Test Configuration Dev
[Octopus Deploy] Automatically selecting the best channel for this release...
[Octopus Deploy] Building a release plan for Channel 'Default'...
[Octopus Deploy] Finding deployment process...
[Octopus Deploy] Finding release template...
[Octopus Deploy] The package version for some steps was not specified. Going to try and resolve those automatically...
[Octopus Deploy] Finding latest package for step: Install Company Test App Config Service
[Octopus Deploy] Octopus Server returned an error: The V2 feed at 'http://collaboration.company.de/httpAuth/app/nuget/feed/_Root/default/v2/FindPackagesById()?id='TestApp.test'&semVerLevel=2.0.0' returned an unexpected status code '403 '.
[Octopus Deploy] Server exception: 
[Octopus Deploy] The V2 feed at 'http://collaboration.company.de/httpAuth/app/nuget/feed/_Root/default/v2/FindPackagesById()?id='TestApp.test'&semVerLevel=2.0.0' returned an unexpected status code '403 '.
[Octopus Deploy] NuGet.Protocol.Core.Types.FatalProtocolException
[Octopus Deploy] at NuGet.Protocol.V2FeedParser.<>c__DisplayClass53_0.<LoadXmlAsync
[Octopus Deploy] at NuGet.Protocol.HttpSource.ProcessResponseAsync
[Octopus Deploy] at NuGet.Protocol.V2FeedParser.LoadXmlAsync
[Octopus Deploy] at NuGet.Protocol.V2FeedParser.QueryV2Feed
[Octopus Deploy] at NuGet.Protocol.V2FeedParser.FindPackagesByIdAsync
[Octopus Deploy] at NuGet.Protocol.PackageMetadataResourceV2Feed.GetMetadataAsync
[Octopus Deploy] at Octopus.Shared.Util.TaskExtensions.PrepareForRethrow(Exception exception)
[Octopus Deploy] at Octopus.Shared.Util.TaskExtensions.SafeResult[T](Task`1 task, CancellationToken cancellationToken)
[Octopus Deploy] at Octopus.Core.Packages.NuGet.ExternalHttpNuGetPackageFeed.FetchPackageMetadataForAllVersionsExpensive(String packageId, Boolean allowPreRelease, CancellationToken cancellationToken)
[Octopus Deploy] at Octopus.Core.Packages.NuGet.ExternalHttpNuGetPackageFeed.ListVersions(String packageId, CancellationToken cancellationToken, PackageVersionSearchOptions searchOptions, Int32& total, Int32 skip, Int32 take, Boolean includeReleaseNotes)
[Octopus Deploy] at Octopus.Server.Web.Api.Actions.PackageSearchActionOld.Search(String feedId, String packageId, Boolean partialMatch, Boolean includeMultipleVersions, Boolean includeNotes, Int32 take, PackageVersionSearchOptions searchOptions, Boolean descriptionsOptional)
[Octopus Deploy] at Octopus.Server.Web.Api.Actions.PackageSearchActionOld.ExecuteRegistered()
[Octopus Deploy] at Octopus.Server.Web.Infrastructure.Api.Responder`1.Respond(TDescriptor options, NancyContext context)
[Octopus Deploy] at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
[Octopus Deploy] at Octopus.Server.Web.Infrastructure.OctopusNancyModule.<>c__DisplayClass14_0.<get_Routes>b__1(Object x)
[Octopus Deploy] at Nancy.Routing.Route.<>c__DisplayClass4.<Wrap>b__3(Object parameters, CancellationToken context)
[Octopus Deploy] -----------------------
[Octopus Deploy] 
[Octopus Deploy] Error from Octopus Server (HTTP 500 InternalServerError)
[Octopus Deploy] Exit code: -7
[Octopus Deploy] Octo.exe exit code: -7
[Step 6/6] Unable to create or deploy release. Please check the build log for details on the error.
[Step 6/6] Unable to create or deploy release. Please check the build log for details on the error.
[Step 6/6] Step OctopusDeploy: Create release failed

2019 年 6 月 14 日更新:

尝试在 Octopus Deploy 中手动创建发布时,会显示以下匹配的错误消息:

The V2 feed at 'http://collaboration.company.de/httpAuth/app/nuget/feed/_Root/default/v2/FindPackagesById()?id='TestApp.test'&semVerLevel=2.0.0' returned an unexpected status code '403 '.

这听起来像是一个身份验证问题。我想我在 Library -> External Feeds -> TeamCity Packages -> Credentials 找到了 OctopusDeploy 的结尾。但是,我不知道在 TeamCity 中配置凭据的匹配端隐藏在哪里。它似乎不在部署步骤中。有谁知道在哪里配置这个?

【问题讨论】:

  • 日志用于 2 个不同的步骤。否则导航到你的 NuGet 服务器并检查预期的 nuget 包版本是否存在。
  • 这些日志用于同一步骤。在此之前我们只在管道中添加了一个测试步骤,但我不明白这可能是什么问题。此外,我已经验证了该包存在于存储库中。我可以在章鱼库里找到0.0.0-develop.17就好了。

标签: teamcity octopus-deploy


【解决方案1】:

您的包裹更改自:

--package DemoFetcher:0.0.0-develop.10

到:

--package DemoFetcher:0.0.0-develop.17

第二份工作找不到这个包裹:

http://collaboration.company.de/httpAuth/app/nuget/feed/_Root/default/v2/FindPackagesById()?id='TestApp.test'&semVerLevel=2.0.0' returned an unexpected status code '403 '

还原您的包或验证所有包都存在于您的 NuGet 服务器上。

【讨论】:

  • 包版本改变是预期的行为。这在以前适用于高达DemoFetcher:0.0.0-develop.10 的各种版本。另外,我已经验证了包DemoFetcher:0.0.0-develop.17 存在于八达通图书馆的提要中。
  • 验证你有这个包:'TestApp.test&semVerLevel=2.0.0' 这就是安装失败的原因
【解决方案2】:

好的,我现在弄清楚了,原来是一个两层问题,一旦弄清楚问题所在,就很容易解决了。

表面上的问题是,OctopusDeploy 用于访问 TeamCity Packages 源的 TeamCity 中的“章鱼”登录不再有效。

然而,实际的问题是 OctopusDeploy 中的构建配置首先尝试使用 TeamCity Packages 源,即使该包在早期构建步骤中被推送到内部 OctopusDeploy 源。

我现在设法通过将“Test Configuration Dev”项目的Process中受影响部署步骤的Package Details中的Package feed从“TeamCity Packages”更改为“Octopus Server(内置-中)”。

现在可以了。

总结一下:如果您有这个问题,请尝试使用内部八达通提要作为包源,因为它更易于配置。

【讨论】:

    【解决方案3】:

    我找到了发生这种情况的原因:

    由于某种原因,Octopus 被配置为在 TeamCity 订阅源中查找包裹,而 TeamCity 将包裹推送到八达通订阅源。我通过告诉 Octopus 从集成的 Octopus Feed 而不是 TeamCity Feed 中获取包来解决此问题,现在它可以工作了。

    现在让我感到困惑的是,这可能以前是如何工作的,特别是因为我无法在 Octopus 或 TeamCity 的审计中检测到任何配置更改。但是哦,好吧,只要它现在有效,就可以了。

    【讨论】:

      猜你喜欢
      • 2017-04-21
      • 2023-04-03
      • 1970-01-01
      • 1970-01-01
      • 2019-11-27
      • 1970-01-01
      • 2019-09-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多