From b79b295f1b08c273d22004521e217c6e4db7bbbd Mon Sep 17 00:00:00 2001 From: Phil Asmar Date: Tue, 17 Oct 2023 12:55:41 -0400 Subject: [PATCH] update image uploader console app to work with latest changes --- test/AWS.Deploy.DockerImageUploader/App.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/test/AWS.Deploy.DockerImageUploader/App.cs b/test/AWS.Deploy.DockerImageUploader/App.cs index ac4ee7aa..d6446728 100644 --- a/test/AWS.Deploy.DockerImageUploader/App.cs +++ b/test/AWS.Deploy.DockerImageUploader/App.cs @@ -9,6 +9,10 @@ using System; using System.Threading.Tasks; using System.IO; +using System.Linq; +using AWS.Deploy.Common.Recipes; +using AWS.Deploy.Orchestration; +using AWS.Deploy.Orchestration.RecommendationEngine;S namespace AWS.Deploy.DockerImageUploader { @@ -20,6 +24,7 @@ public class App private readonly IFileManager _fileManager; private readonly IDirectoryManager _directoryManager; private readonly IProjectDefinitionParser _projectDefinitionParser; + private readonly IRecipeHandler _recipeHandler; private readonly CLI.App _deployToolCli; private readonly List _testApps = new() { "WebApiNET6", "ConsoleAppTask" }; @@ -29,6 +34,7 @@ public App(IServiceProvider serviceProvider) _projectDefinitionParser = serviceProvider.GetRequiredService(); _fileManager = serviceProvider.GetRequiredService(); _directoryManager = serviceProvider.GetRequiredService(); + _recipeHandler = serviceProvider.GetRequiredService(); _deployToolCli = serviceProvider.GetRequiredService(); } @@ -49,9 +55,11 @@ public async Task Run() private async Task CreateImageAndPushToECR(string projectPath) { var projectDefinition = await _projectDefinitionParser.Parse(projectPath); - + var orchestratorSession = new OrchestratorSession(projectDefinition); + var recommendationEngine = new RecommendationEngine(orchestratorSession, _recipeHandler); + var recommendations = await recommendationEngine.ComputeRecommendations(); var dockerEngine = new DockerEngine.DockerEngine(projectDefinition, _fileManager, _directoryManager); - dockerEngine.GenerateDockerFile(); + dockerEngine.GenerateDockerFile(recommendations.First()); var configFilePath = Path.Combine(projectPath, "DockerImageUploaderConfigFile.json"); var deployArgs = new[] { "deploy", "--project-path", projectPath, "--diagnostics", "--apply", configFilePath, "--silent" };