八达通部署:创建发布步骤失败,出现错误"feed返回意外状态代码'403'"



我有一个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 日更新:

尝试在八达通部署中手动创建版本时,会显示以下匹配的错误消息:

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 '.

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

您的软件包从:

--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 服务器上是否存在所有包。

好的,我现在想通了,结果证明这是一个两层问题,一旦我弄清楚问题是什么,就很容易解决。

表面上的問題是,OctopusDeploy用來存取TeamCity Packages feed的TeamCity中的"章鱼"登入不再有效。

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

我现在设法通过将"测试配置开发"项目Process中受影响的部署步骤Package Details中的Package feed从"TeamCity Packages"更改为"Octopus Server (内置)"来解决此问题。

现在它起作用了。

总结一下:如果您遇到此问题,请尝试使用内部章鱼饲料作为包源,因为它更容易配置。

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

出于某种原因,八达通被配置为在TeamCity提要中查找包裹,而TeamCity则将包裹推送到八达通馈送。我通过告诉八达通从集成的八达通饲料而不是TeamCity饲料中获取包装来解决此问题,现在它可以工作了。

现在让我感到困惑的是,这在以前是如何工作的,特别是因为我无法在八达通或TeamCity的审计中检测到任何配置更改。但是哦,好吧,只要它现在有效,那没关系。

相关内容

最新更新