OctopusDeploy / Issues

| Public | Bug reports and known issues for Octopus Deploy and all related tools
https://octopus.com
162 stars 20 forks source link

Sequence contains more than one matching element when trying to deploy #7933

Open FelixBrunet opened 1 year ago

FelixBrunet commented 1 year ago

We are using this version:2022.3.10807

On a version controlled project, after selecting the environment to deploy to This is coming from the previews API /api/Spaces-1/releases/Releases-154704/deployments/previews/"

Unhandled error on request: "Sequence contains more than one matching element" System.InvalidOperationException: Sequence contains more than one matching element at System.Linq.ThrowHelper.ThrowMoreThanOneMatchException() at System.Linq.Enumerable.TryGetSingle[TSource](IEnumerable1 source, Func2 predicate, Boolean& found) at Octopus.Core.Model.Projects.IHaveStepsExtensionMethods.GetTargetRoles(IHaveSteps process, String deploymentActionId, TagTesterFactory tagTesterFactory) in ./source/Octopus.Core/Model/Projects/IHaveSteps.cs:line 115 at Octopus.Server.Orchestration.ServerTasks.Deploy.DeploymentFactory.<>cDisplayClass25_0.b6(<>fAnonymousType222 <>h__TransparentIdentifier0) in ./source/Octopus.Server/Orchestration/ServerTasks/Deploy/DeploymentFactory.cs:line 378 at System.Linq.Utilities.<>c__DisplayClass2_03.b0(TSource x) at System.Linq.Utilities.<>cDisplayClass2_03.<CombineSelectors>b__0(TSource x) at System.Linq.Utilities.<>c__DisplayClass2_03.b0(TSource x) at System.Linq.Enumerable.WhereSelectEnumerableIterator2.ToList() at Octopus.Server.Orchestration.ServerTasks.Deploy.DeploymentFactory.CreateDeploymentPreviewWithEnvironmentAndTenant(IOctopusQueryExecutor queryExecutor, DeploymentEnvironmentId environmentId, TenantId tenantId, Tenant tenant, Boolean includeDisabledSteps, IOctopusPrincipal user, Release release, Project project, DeploymentProcess deploymentProcess, IOctopusQueryExecutor queryExecutorAsUserWithAllPermissions, Channel channel, ProjectGroup projectGroup, Space space, VariableCollection projectVariables, VariableCollection libraryVariables, StaticDeploymentEnvironment environment, List1 promptVariables, List1 deploymentTargetsInEnvironment) in ./source/Octopus.Server/Orchestration/ServerTasks/Deploy/DeploymentFactory.cs:line 0 at Octopus.Server.Orchestration.ServerTasks.Deploy.DeploymentFactory.<>c__DisplayClass24_1.<CreateDeploymentPreviews>b__9(TenantId tenantId) in ./source/Octopus.Server/Orchestration/ServerTasks/Deploy/DeploymentFactory.cs:line 268 at System.Linq.Enumerable.SelectIListIterator2.MoveNext() at System.Collections.Generic.EnumerableHelpers.IterativeCopy[T](IEnumerable1 source, T[] array, Int32 arrayIndex, Int32 count) at System.Linq.Enumerable.SelectManySingleSelectorIterator2.ToArray() at Octopus.Server.Orchestration.ServerTasks.Deploy.DeploymentFactory.CreateDeploymentPreviews(IOctopusQueryExecutor queryExecutor, ReleaseId releaseId, IEnumerable1 previewRequests, Boolean includeDisabledSteps, IOctopusPrincipal user) in ./source/Octopus.Server/Orchestration/ServerTasks/Deploy/DeploymentFactory.cs:line 292 at Octopus.Server.Web.Api.Actions.Releases.DeploymentPreviewCollectionAction.ExecuteRegistered(String releaseId) in ./source/Octopus.Server/Web/Api/Actions/Releases/DeploymentPreviewCollectionAction.cs:line 38 at Octopus.Server.Web.Infrastructure.Api.CustomActionWithIdResponder1.ExecuteRegistered() in ./source/Octopus.Server/Web/Infrastructure/Api/CustomActionResponder.cs:line 48 at Octopus.Server.Web.Infrastructure.Api.CustomResponder1.ExecuteRegistered(CancellationToken cancellationToken) in ./source/Octopus.Server/Web/Infrastructure/Api/CustomResponder.cs:line 344 at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException[TResult](Task1 task) at Octopus.Server.Web.Infrastructure.Api.CustomResponder1.Respond(TDescriptor options, NancyContext context) in ./source/Octopus.Server/Web/Infrastructure/Api/CustomResponder.cs:line 292 at Octopus.Server.Web.Infrastructure.Api.CustomResponder1.Respond(Object options, NancyContext context, CancellationToken cancellationToken) in ./source/Octopus.Server/Web/Infrastructure/Api/CustomResponder.cs:line 287 at Octopus.Server.Web.Infrastructure.OctopusNancyModule.<>cDisplayClass14_0.b1(Object _, CancellationToken cancellationToken) in ./source/Octopus.Server/Web/Infrastructure/OctopusNancyModule.cs:line 158 at Nancy.Routing.Route1.Invoke(DynamicDictionary parameters, CancellationToken cancellationToken) at Nancy.Routing.DefaultRouteInvoker.Invoke(Route route, CancellationToken cancellationToken, DynamicDictionary parameters, NancyContext context) at Nancy.Routing.DefaultRequestDispatcher.Dispatch(NancyContext context, CancellationToken cancellationToken) at Nancy.NancyEngine.InvokeRequestLifeCycle(NancyContext context, CancellationToken cancellationToken, IPipelines pipelines) at Octopus.NancyOwin.NancyMiddleware.RequestComplete(NancyContext context, IDictionary2 environment, CancellationToken cancellationToken) in ./source/Octopus.Server/Owin/NancyMiddleware.cs:line 174 at Octopus.NancyOwin.NancyMiddleware.<>cDisplayClass3_0.<b1>d.MoveNext() in ./source/Octopus.Server/Owin/NancyMiddleware.cs:line 110 --- End of stack trace from previous location --- at Microsoft.AspNetCore.Owin.WebSocketAcceptAdapter.<>cDisplayClass6_0.<b0>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) at Octopus.Server.Web.UnitOfWorkMiddleware.InvokeAsync(HttpContext httpContext, IUnitOfWork unitOfWork) in ./source/Octopus.Server/Web/UnitOfWorkMiddleware.cs:line 47 at Octopus.Server.Web.UnitOfWorkMiddleware.InvokeAsync(HttpContext httpContext, IUnitOfWork unitOfWork) in ./source/Octopus.Server/Web/UnitOfWorkMiddleware.cs:line 47 at Octopus.Server.Web.Middleware.OctopusClientOldVersionWarningMiddleware.InvokeAsync(HttpContext context, IAutomationContext automationContext) in ./source/Octopus.Server/Web/Middleware/OctopusClientOldVersionWarningMiddleware.cs:line 53 at Octopus.Server.Web.Middleware.DynamicContentHeadersMiddleware.InvokeAsync(HttpContext context) in ./source/Octopus.Server/Web/Middleware/DynamicContentHeadersMiddleware.cs:line 49 at Octopus.Server.Web.Middleware.PrivateSpaceToggleMiddleware.InvokeAsync(HttpContext context) in ./source/Octopus.Server/Web/Middleware/PrivateSpaceToggleMiddleware.cs:line 56 at Octopus.Server.Web.Middleware.MaintenanceModeMiddleware.InvokeAsync(HttpContext context) in ./source/Octopus.Server/Web/Middleware/MaintenanceModeMiddleware.cs:line 61 at Octopus.Server.Web.Middleware.OctopusAuthenticationMiddleware.InvokeAsync(HttpContext context, IUserAuthenticator userAuthenticator, IAuthCookieService authCookieService, IWebAuthCache authCache, ILogger logger) in ./source/Octopus.Server/Web/Middleware/OctopusAuthenticationMiddleware.cs:line 57 at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Octopus.Server.Web.Middleware.LegacyRequestLoggerMiddleware.InvokeAsync(HttpContext context) in ./source/Octopus.Server/Web/Middleware/LegacyRequestLoggerMiddleware.cs:line 42 at Octopus.Server.Web.Middleware.TelemetryMiddleware.InvokeAsync(HttpContext context) in ./source/Octopus.Server/Web/Middleware/TelemetryMiddleware.cs:line 76 at Octopus.Server.Web.Middleware.ErrorHandlingMiddleware.InvokeAsync(HttpContext context) in ./source/Octopus.Server/Web/Middleware/ErrorHandlingMiddleware.cs:line 98 November 28th 2022 06:10:19Error "HTTP" "POST" to "msenterpriseoctopus.morneaushepell.com""/api/Spaces-1/releases/Releases-154704/deployments/previews/" completed with 500 in 00:00:09.1654993 (9165ms) by "Félix Brunet Girard"

FelixBrunet commented 1 year ago

I believe when the OCL was generated by Octopus , I got duplicates step name , similar to https://github.com/OctopusDeploy/Issues/issues/7783