Skip to content

Commit

Permalink
Merge pull request #341 from aws/dev
Browse files Browse the repository at this point in the history
chore: release 0.20
  • Loading branch information
96malhar authored Sep 29, 2021
2 parents 48a9adc + dd391d4 commit 869be21
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public async Task ExecuteAsync(string saveCdkDirectoryPath, string projectDispla

var saveCdkDirectoryFullPath = _directoryManager.GetDirectoryInfo(saveCdkDirectoryPath).FullName;
_toolInteractiveService.WriteLine();
_toolInteractiveService.WriteLine($"The CDK deployment project is saved at: {saveCdkDirectoryFullPath}");
_toolInteractiveService.WriteLine($"Saving AWS CDK deployment project to: {saveCdkDirectoryFullPath}");

await _deploymentManifestEngine.UpdateDeploymentManifestFile(saveCdkDirectoryFullPath, _targetApplicationFullPath);
}
Expand Down
6 changes: 3 additions & 3 deletions src/AWS.Deploy.Orchestration/CdkProjectHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public async Task<string> ConfigureCdkProject(OrchestratorSession session, Cloud
else
{
// Create a new temporary CDK project for a new deployment
_interactiveService.LogMessageLine($"Generating a {recommendation.Recipe.Name} CDK Project");
_interactiveService.LogMessageLine("Generating AWS Cloud Development Kit (AWS CDK) deployment project");
cdkProjectPath = CreateCdkProject(recommendation, session);
}

Expand All @@ -69,7 +69,7 @@ public async Task DeployCdkProject(OrchestratorSession session, string cdkProjec
{ EnvironmentVariableKeys.AWS_EXECUTION_ENV, recipeInfo }
};

_interactiveService.LogMessageLine("Starting deployment of CDK Project");
_interactiveService.LogMessageLine("Deploying AWS CDK project");

// Ensure region is bootstrapped
await _commandLineWrapper.Run($"npx cdk bootstrap aws://{session.AWSAccountId}/{session.AWSRegion}",
Expand Down Expand Up @@ -115,7 +115,7 @@ public string CreateCdkProject(Recommendation recommendation, OrchestratorSessio
var templateEngine = new TemplateEngine();
templateEngine.GenerateCDKProjectFromTemplate(recommendation, session, saveCdkDirectoryPath, assemblyName);

_interactiveService.LogDebugLine($"The CDK Project is saved at: {saveCdkDirectoryPath}");
_interactiveService.LogDebugLine($"Saving AWS CDK deployment project to: {saveCdkDirectoryPath}");
return saveCdkDirectoryPath;
}

Expand Down
16 changes: 14 additions & 2 deletions src/AWS.Deploy.Orchestration/Orchestrator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using AWS.Deploy.Common;
using AWS.Deploy.Common.IO;
Expand All @@ -25,6 +26,7 @@ namespace AWS.Deploy.Orchestration
/// </summary>
public class Orchestrator
{
private static readonly SemaphoreSlim s_cdkManagerSemaphoreSlim = new(1,1);
private const string REPLACE_TOKEN_LATEST_DOTNET_BEANSTALK_PLATFORM_ARN = "{LatestDotnetBeanstalkPlatformArn}";

private readonly ICdkProjectHandler? _cdkProjectHandler;
Expand Down Expand Up @@ -158,12 +160,22 @@ public async Task DeployRecommendation(CloudApplication cloudApplication, Recomm
throw new InvalidOperationException($"{nameof(_directoryManager)} must not be null.");
}

_interactiveService.LogMessageLine("Configuring AWS Cloud Development Kit (CDK)...");
var cdkProject = await _cdkProjectHandler.ConfigureCdkProject(_session, cloudApplication, recommendation);
_interactiveService.LogMessageLine("AWS CDK is being configured.");

var projFiles = _directoryManager.GetProjFiles(cdkProject);
var cdkVersion = _cdkVersionDetector.Detect(projFiles);
await _cdkManager.EnsureCompatibleCDKExists(Constants.CDK.DeployToolWorkspaceDirectoryRoot, cdkVersion);

await s_cdkManagerSemaphoreSlim.WaitAsync();

try
{
await _cdkManager.EnsureCompatibleCDKExists(Constants.CDK.DeployToolWorkspaceDirectoryRoot, cdkVersion);
}
finally
{
s_cdkManagerSemaphoreSlim.Release();
}

try
{
Expand Down
4 changes: 2 additions & 2 deletions test/AWS.Deploy.CLI.IntegrationTests/BlazorWasmTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ public async Task DefaultConfigurations(params string[] components)

var deployStdOut = _interactiveService.StdOutReader.ReadAllLines();

var tempCdkProjectLine = deployStdOut.First(line => line.StartsWith("The CDK Project is saved at:"));
var tempCdkProject = tempCdkProjectLine.Split(":")[1].Trim();
var tempCdkProjectLine = deployStdOut.First(line => line.StartsWith("Saving AWS CDK deployment project to: "));
var tempCdkProject = tempCdkProjectLine.Split(": ")[1].Trim();
Assert.False(Directory.Exists(tempCdkProject), $"{tempCdkProject} must not exist.");

// Example URL string: BlazorWasm5068e7a879d5ee.EndpointURL = http://blazorwasm5068e7a879d5ee-blazorhostc7106839-a2585dcq9xve.s3-website-us-west-2.amazonaws.com/
Expand Down
4 changes: 2 additions & 2 deletions test/AWS.Deploy.CLI.IntegrationTests/ConsoleAppTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ public async Task DefaultConfigurations(params string[] components)

var deployStdOut = _interactiveService.StdOutReader.ReadAllLines();

var tempCdkProjectLine = deployStdOut.First(line => line.StartsWith("The CDK Project is saved at:"));
var tempCdkProject = tempCdkProjectLine.Split(":")[1].Trim();
var tempCdkProjectLine = deployStdOut.First(line => line.StartsWith("Saving AWS CDK deployment project to: "));
var tempCdkProject = tempCdkProjectLine.Split(": ")[1].Trim();
Assert.False(Directory.Exists(tempCdkProject), $"{tempCdkProject} must not exist.");

// list
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static async Task CreateCDKDeploymentProject(string targetApplicationPath

// Verify project is saved
var stdOut = interactiveService.StdOutReader.ReadAllLines();
var successMessage = $"The CDK deployment project is saved at: {saveDirectoryPath}";
var successMessage = $"Saving AWS CDK deployment project to: {saveDirectoryPath}";

if (!isValid)
{
Expand Down Expand Up @@ -87,7 +87,7 @@ public static async Task CreateCDKDeploymentProjectWithRecipeName(string targetA

// Verify project is saved
var stdOut = interactiveService.StdOutReader.ReadAllLines();
var successMessage = $"The CDK deployment project is saved at: {saveDirectoryPath}";
var successMessage = $"Saving AWS CDK deployment project to: {saveDirectoryPath}";

if (!isValid)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ public async Task DefaultConfigurations()

var deployStdOut = _interactiveService.StdOutReader.ReadAllLines();

var tempCdkProjectLine = deployStdOut.First(line => line.StartsWith("The CDK Project is saved at:"));
var tempCdkProject = tempCdkProjectLine.Split(":")[1].Trim();
var tempCdkProjectLine = deployStdOut.First(line => line.StartsWith("Saving AWS CDK deployment project to: "));
var tempCdkProject = tempCdkProjectLine.Split(": ")[1].Trim();
Assert.False(Directory.Exists(tempCdkProject), $"{tempCdkProject} must not exist.");

// Example: Endpoint: http://52.36.216.238/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ public async Task DefaultConfigurations()

var deployStdOut = _interactiveService.StdOutReader.ReadAllLines();

var tempCdkProjectLine = deployStdOut.First(line => line.StartsWith("The CDK Project is saved at:"));
var tempCdkProject = tempCdkProjectLine.Split(":")[1].Trim();
var tempCdkProjectLine = deployStdOut.First(line => line.StartsWith("Saving AWS CDK deployment project to: "));
var tempCdkProject = tempCdkProjectLine.Split(": ")[1].Trim();
Assert.False(Directory.Exists(tempCdkProject), $"{tempCdkProject} must not exist.");

var applicationUrl = deployStdOut.First(line => line.Trim().StartsWith("Endpoint:"))
Expand Down

0 comments on commit 869be21

Please sign in to comment.