diff --git a/src/AWS.Deploy.CLI/ServerMode/Controllers/DeploymentController.cs b/src/AWS.Deploy.CLI/ServerMode/Controllers/DeploymentController.cs index da87716a..303524e9 100644 --- a/src/AWS.Deploy.CLI/ServerMode/Controllers/DeploymentController.cs +++ b/src/AWS.Deploy.CLI/ServerMode/Controllers/DeploymentController.cs @@ -699,6 +699,15 @@ private IServiceProvider CreateSessionServiceProvider(SessionState state) services.AddSingleton(state.AWSResourceQueryService); } + if (state.SystemCapabilityEvaluator == null) + { + services.AddSingleton(); + } + else + { + services.AddSingleton(state.SystemCapabilityEvaluator); + } + services.AddCustomServices(); var serviceProvider = services.BuildServiceProvider(); @@ -710,9 +719,11 @@ private IServiceProvider CreateSessionServiceProvider(SessionState state) awsOptions.Region = RegionEndpoint.GetBySystemName(state.AWSRegion); }); - // Cache the SessionAWSResourceQuery with the session state so it can be reused in future - // ServerMode API calls with the same session id. + // Cache the SessionAWSResourceQuery and SystemCapabilityEvaluator with the session state + // so they can be reused in future ServerMode API calls with the same session id. This avoids reloading + // existing resources from AWS and running the Docker/Node checks when they're not expected to change. state.AWSResourceQueryService = serviceProvider.GetRequiredService() as SessionAWSResourceQuery; + state.SystemCapabilityEvaluator = serviceProvider.GetRequiredService() as SystemCapabilityEvaluator; return serviceProvider; } diff --git a/src/AWS.Deploy.CLI/ServerMode/SessionState.cs b/src/AWS.Deploy.CLI/ServerMode/SessionState.cs index bbac2086..19d9a3d3 100644 --- a/src/AWS.Deploy.CLI/ServerMode/SessionState.cs +++ b/src/AWS.Deploy.CLI/ServerMode/SessionState.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using AWS.Deploy.CLI.ServerMode.Services; using AWS.Deploy.Common; +using AWS.Deploy.Orchestration; namespace AWS.Deploy.CLI.ServerMode { @@ -30,6 +31,8 @@ public class SessionState public SessionAWSResourceQuery? AWSResourceQueryService { get; set; } + public SystemCapabilityEvaluator? SystemCapabilityEvaluator { get; set; } + public Task? DeploymentTask { get; set; } public SessionState(