OctopusDeploy:创建发布步骤失败,并显示错误“提要返回了意外的状态码'403'”

时间:2019-06-12 14:27:54

标签: teamcity octopus-deploy

我有一个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

更新14-六月-2019:

当尝试在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 '.

这听起来像是身份验证问题。我想我在OctopusDeploy的库->外部提要-> TeamCity软件包->凭证中找到了结尾。但是,我不知道在TeamCity中用于配置凭据的匹配端在哪里隐藏。它似乎不在“部署步骤”中。有人知道在哪里配置吗?

3 个答案:

答案 0 :(得分:0)

您的包裹已更改为:

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

答案 1 :(得分:0)

好吧,现在我想出了一个问题,事实证明这是一个两层的问题,一旦我弄清了什么问题,就可以轻松解决。

表面上的问题是OctopusDeploy用于访问TeamCity Packages feed的TeamCity中的“章鱼”登录名不再起作用。

但是,实际的问题是OctopusDeploy中的构建配置首先尝试使用TeamCity Packages提要,即使该包在较早的构建步骤中已推送到内部OctopusDeploy提要中。

我现在设法通过将“测试配置开发”项目的Package feed中受影响的部署步骤的Package Details中的Process从“ TeamCity Packages”更改为“章鱼服务器(内置)”。

现在可以了。

因此总结:如果您有此问题,请尝试使用内部章鱼饲料作为包装来源,因为它更易于配置。

答案 2 :(得分:0)

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

由于某种原因,章鱼配置为在TeamCity提要中查找软件包,而TeamCity将软件包推到章鱼提要中。我通过告诉Octopus从集成的Octopus Feed(而不是TeamCity feed)中获取软件包来解决此问题,现在它可以工作了。

现在让我感到困惑的是,这本来可能是如何工作的,尤其是因为我无法在Octopus或TeamCity的Audit中检测到任何配置更改。但是,哦,只要它现在可以正常工作就可以了。