Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/AWS.Deploy.CLI/Commands/DeployCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ private void DisplayOutputResources(List<DisplayedResourceItem> displayedResourc
directoryManager,
awsServiceHandler,
optionSettingHandler,
deployToolWorkspaceMetadata);
deployToolWorkspaceMetadata,
systemCapabilityEvaluator);

// Determine what recommendations are possible for the project.
var recommendations = await GenerateDeploymentRecommendations(orchestrator, deploymentProjectPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,8 @@ private Orchestrator CreateOrchestrator(SessionState state, IServiceProvider? se
serviceProvider.GetRequiredService<IDirectoryManager>(),
serviceProvider.GetRequiredService<IAWSServiceHandler>(),
serviceProvider.GetRequiredService<IOptionSettingHandler>(),
serviceProvider.GetRequiredService<IDeployToolWorkspaceMetadata>()
serviceProvider.GetRequiredService<IDeployToolWorkspaceMetadata>(),
serviceProvider.GetRequiredService<ISystemCapabilityEvaluator>()
);
}
}
Expand Down
15 changes: 13 additions & 2 deletions src/AWS.Deploy.Orchestration/Orchestrator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
using Amazon.EC2.Model;
Expand Down Expand Up @@ -43,6 +44,7 @@
internal readonly IAWSServiceHandler? _awsServiceHandler;
private readonly IOptionSettingHandler? _optionSettingHandler;
internal readonly IDeployToolWorkspaceMetadata? _workspaceMetadata;
internal readonly ISystemCapabilityEvaluator? _systemCapabilityEvaluator;

public Orchestrator(
OrchestratorSession session,
Expand All @@ -59,7 +61,8 @@
IDirectoryManager directoryManager,
IAWSServiceHandler awsServiceHandler,
IOptionSettingHandler optionSettingHandler,
IDeployToolWorkspaceMetadata deployToolWorkspaceMetadata)
IDeployToolWorkspaceMetadata deployToolWorkspaceMetadata,
ISystemCapabilityEvaluator systemCapabilityEvaluator)
{
_session = session;
_interactiveService = interactiveService;
Expand All @@ -76,6 +79,7 @@
_awsServiceHandler = awsServiceHandler;
_optionSettingHandler = optionSettingHandler;
_workspaceMetadata = deployToolWorkspaceMetadata;
_systemCapabilityEvaluator = systemCapabilityEvaluator;
}

public Orchestrator(OrchestratorSession session, IRecipeHandler recipeHandler)
Expand Down Expand Up @@ -261,11 +265,18 @@
{
if (_interactiveService == null)
throw new InvalidOperationException($"{nameof(_interactiveService)} is null as part of the orchestrator object");
if (_systemCapabilityEvaluator == null)
throw new InvalidOperationException($"{nameof(_systemCapabilityEvaluator)} is null as part of the orchestrator object");

Check warning on line 269 in src/AWS.Deploy.Orchestration/Orchestrator.cs

View check run for this annotation

Codecov / codecov/patch

src/AWS.Deploy.Orchestration/Orchestrator.cs#L269

Added line #L269 was not covered by tests

if (recommendation.Recipe.DeploymentBundle == DeploymentBundleTypes.Container)
{
var installedContainerAppInfo = await _systemCapabilityEvaluator.GetInstalledContainerAppInfo(recommendation);
var commandName = installedContainerAppInfo?.AppName?.ToLower();
if (string.IsNullOrEmpty(commandName))
throw new ContainerBuildFailedException(DeployToolErrorCode.ContainerBuildFailed, "No container app (Docker or Podman) is currently installed/running on your system.", -1);

Check warning on line 276 in src/AWS.Deploy.Orchestration/Orchestrator.cs

View check run for this annotation

Codecov / codecov/patch

src/AWS.Deploy.Orchestration/Orchestrator.cs#L276

Added line #L276 was not covered by tests

_interactiveService.LogSectionStart("Creating deployment image",
"Using the docker CLI to perform a docker build to create a container image.");
$"Using the {CultureInfo.CurrentCulture.TextInfo.ToTitleCase(commandName)} CLI to create a container image.");
try
{
await CreateContainerDeploymentBundle(cloudApplication, recommendation);
Expand Down
4 changes: 3 additions & 1 deletion src/AWS.Deploy.Orchestration/SystemCapabilityEvaluator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ private async Task<ContainerAppInfo> HasPodmanInstalledAndRunningAsync()
{
var processExitCode = -1;
var containerType = "";
var command = "podman info --format=json | jq -r '.host.os'";
var command = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ?
"powershell -NoProfile -Command \"(podman info --format=json | ConvertFrom-Json).host.os\"" :
"podman info --format=json | jq -r '.host.os'";

var cancellationTokenSource = new CancellationTokenSource();
cancellationTokenSource.CancelAfter(CAPABILITY_EVALUATION_TIMEOUT_MS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ private async Task<Orchestrator> GetOrchestrator(string targetApplicationProject
directoryManager,
new Mock<IAWSServiceHandler>().Object,
new OptionSettingHandler(new Mock<IValidatorFactory>().Object),
deployToolWorkspaceMetadata);
deployToolWorkspaceMetadata,
new Mock<ISystemCapabilityEvaluator>().Object);
}

private async Task<string> GetCustomRecipeId(string recipeFilePath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public ApplyPreviousSettingsTests()
var optionSettingHandler = new OptionSettingHandler(validatorFactory);
_recipeHandler = new RecipeHandler(_deploymentManifestEngine, _orchestratorInteractiveService, _directoryManager, _fileManager, optionSettingHandler, validatorFactory);
_optionSettingHandler = new OptionSettingHandler(new ValidatorFactory(_serviceProvider.Object));
_orchestrator = new Orchestrator(null!, _orchestratorInteractiveService, null!, null!, null!, null!, null!, null!, null!, null!, null!, null!, null!, _optionSettingHandler, null!);
_orchestrator = new Orchestrator(null!, _orchestratorInteractiveService, null!, null!, null!, null!, null!, null!, null!, null!, null!, null!, null!, _optionSettingHandler, null!, null!);
}

private async Task<RecommendationEngine> BuildRecommendationEngine(string testProjectName)
Expand Down
Loading