OctopusDeploy / Issues

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

Cannot update project settings when default branch has no OCL. #7830

Closed YuKitsune closed 2 years ago

YuKitsune commented 2 years ago

Team

Severity

Discovered internally, non-blocking

Version

Introduced in 2022.4.4118

Latest Version

I could reproduce the problem in the latest build

What happened?

When converting a project to git, and committing the OCL initially do a non-default branch, the project details cannot be modified:

Screen Shot 2022-10-10 at 11 22 59 am

Reproduction

  1. Create a project
  2. Convert it to a version controlled project with the Initially commit to separate branch option enabled
  3. Try modifying the project details (E.g: Name, description, icon, git settings, etc.)
  4. đŸ’¥

Error and Stacktrace

Octopus.Core.Model.Exceptions.DomainException: The file 'schema_version.ocl' does not exist in the Git repository.
   at Octopus.Core.Git.Schema.GitSchemaVersionProvider.LoadSchemaVersionsWithFileCheck(CancellationToken cancellationToken) in ./source/Octopus.Core/Git/Schema/GitSchemaVersionProvider.cs:line 57
   at Octopus.Core.Git.Transactions.GitDocumentTransaction.IsInitialized(CancellationToken cancellationToken) in ./source/Octopus.Core/Git/Transactions/GitDocumentTransaction.cs:line 193
   at Octopus.Core.Git.Transactions.GitDocumentTransaction.MigrateBeforeExecute[T](Func`1 innerOperation, CancellationToken cancellationToken) in ./source/Octopus.Core/Git/Transactions/GitDocumentTransaction.cs:line 227
   at Octopus.Core.Git.Transactions.GitDocumentTransaction.GetDocument[T](String fileName, CancellationToken cancellationToken) in ./source/Octopus.Core/Git/Transactions/GitDocumentTransaction.cs:line 69
   at Octopus.Core.Persistence.Git.GitDocumentStore`2.Get(TKey id, CancellationToken cancellationToken) in ./source/Octopus.Core/Persistence/Git/GitDocumentStore.cs:line 88
   at Octopus.Core.Persistence.Git.SlugDocumentStoreDecorator`2.Get(TKey id, CancellationToken cancellationToken) in ./source/Octopus.Core/Persistence/Git/SlugDocumentStoreDecorator.cs:line 83
   at Octopus.Core.Persistence.Git.NameAsIdDocumentStoreDecorator`2.Get(TKey id, CancellationToken cancellationToken) in ./source/Octopus.Core/Persistence/Git/NameAsIdDocumentStoreDecorator.cs:line 39
   at Octopus.Core.Persistence.Database.ProjectPathDecorators.ProjectPathDocumentStoreDecorator`2.Get(TKey id, CancellationToken cancellationToken) in ./source/Octopus.Core/Persistence/Database/ProjectPathDecorators/ProjectPathDocumentStoreDecorator.cs:line 33
   at Octopus.Core.Persistence.EntityTracking.EntityTracker.GetOrTrack[TDocument,TKey](TKey id, Func`3 getDocument, CancellationToken cancellationToken) in ./source/Octopus.Core/Persistence/EntityTracking/EntityTracker.cs:line 70
   at Octopus.Core.Persistence.EntityTracking.EntityTrackingDocumentStoreDecorator`2.Get(TKey id, CancellationToken cancellationToken) in ./source/Octopus.Core/Persistence/EntityTracking/EntityTrackingDocumentStoreDecorator.cs:line 47
   at Octopus.Core.Persistence.Auditing.AuditingDocumentStoreDecorator`2.Get(TKey id, CancellationToken cancellationToken) in ./source/Octopus.Core/Persistence/Auditing/AuditingDocumentStoreDecorator.cs:line 64
   at Octopus.Core.Persistence.DocumentStore`2.Get(TKey id, CancellationToken cancellationToken) in ./source/Octopus.Core/Persistence/DocumentStore.cs:line 76
   at Octopus.Core.Features.Projects.ModifyProjectCommandHandler.Handle(ModifyProjectCommand command, CancellationToken cancellationToken) in ./source/Octopus.Core/Features/Projects/ProjectModifyCommandHandler.cs:line 110
   at Octopus.Core.Infrastructure.Mediator.AutofacMediator.Do[TCommand,TResponse](ICommand`2 command, CancellationToken cancellationToken) in ./source/Octopus.Core/Infrastructure/Mediator/AutofacMediator.cs:line 29
   at Octopus.Core.Infrastructure.Mediator.Decorators.SystemComponentModelValidationDecorator.Do[TCommand,TResponse](ICommand`2 command, CancellationToken cancellationToken) in ./source/Octopus.Core/Infrastructure/Mediator/Decorators/SystemComponentModelValidationDecorator.cs:line 32
   at Octopus.Core.Infrastructure.Mediator.Decorators.FluentValidationsDecorator.Do[TCommand,TResponse](ICommand`2 command, CancellationToken cancellationToken) in ./source/Octopus.Core/Infrastructure/Mediator/Decorators/FluentValidationsDecorator.cs:line 45
   at Octopus.Core.Infrastructure.Mediator.Decorators.MessageBusSiphoningDecorator.Do[TCommand,TResponse](ICommand`2 command, CancellationToken cancellationToken) in ./source/Octopus.Core/Infrastructure/Mediator/Decorators/MessageBusSiphoningDecorator.cs:line 33
   at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException[TResult](Task`1 task)
   at Octopus.Server.Web.Api.Actions.Projects.ProjectModifyResponder.ExecuteRegistered() in ./source/Octopus.Server/Web/Api/Actions/Projects/ProjectModifyResponder.cs:line 38
   at Octopus.Server.Web.Infrastructure.Api.CustomResponder`1.ExecuteRegistered(CancellationToken cancellationToken) in ./source/Octopus.Server/Web/Infrastructure/Api/CustomResponder.cs:line 344
   at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException[TResult](Task`1 task)
   at Octopus.Server.Web.Infrastructure.Api.CustomResponder`1.Respond(TDescriptor options, NancyContext context) in ./source/Octopus.Server/Web/Infrastructure/Api/CustomResponder.cs:line 292
   at Octopus.Server.Web.Infrastructure.Api.CustomResponder`1.Respond(Object options, NancyContext context, CancellationToken cancellationToken) in ./source/Octopus.Server/Web/Infrastructure/Api/CustomResponder.cs:line 287
   at Octopus.Server.Web.Infrastructure.OctopusNancyModule.<>c__DisplayClass14_0.<get_Routes>b__1(Object _, CancellationToken cancellationToken) in ./source/Octopus.Server/Web/Infrastructure/OctopusNancyModule.cs:line 158
   at Nancy.Routing.Route`1.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, IDictionary`2 environment, CancellationToken cancellationToken) in ./source/Octopus.Server/Owin/NancyMiddleware.cs:line 174
   at Octopus.NancyOwin.NancyMiddleware.<>c__DisplayClass3_0.<<UseNancy>b__1>d.MoveNext() in ./source/Octopus.Server/Owin/NancyMiddleware.cs:line 110
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Owin.WebSocketAcceptAdapter.<>c__DisplayClass6_0.<<AdaptWebSockets>b__0>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

More Information

This seems to happen because we're trying to fetch the deployment settings from the default branch when we modify the project.

Workaround

Merging the changes from the initial commit branch into the default branch will resolve this.

Clare-Octopus commented 2 years ago

Another user (might be) experiencing this issue - I mention it because he is on 2022.1.2679.

YuKitsune commented 2 years ago

Hi @Clare-Octopus, doesn't look like this issue is related. This was introduced as part of our work on branch protections, which hasn't been enabled publicly yet.

octoreleasebot commented 2 years ago

Release Note: Fixed an issue where project settings for git projects could not be modified when no OCL existed on the default branch.

Octobob commented 1 year ago

:tada: The fix for this issue has been released in:

Release stream Release
2022.4 2022.4.4709
2023.1+ all releases