Skip to content

Commit

Permalink
Merge pull request #370 from aws/dev
Browse files Browse the repository at this point in the history
chore: release 0.24
  • Loading branch information
96malhar authored Oct 13, 2021
2 parents bdf2e94 + 7153286 commit b1baf24
Show file tree
Hide file tree
Showing 11 changed files with 105 additions and 23 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Recommended Deployment Option
1: ASP.NET Core App to Amazon ECS using Fargate
ASP.NET Core applications built as a container and deployed to Amazon Elastic Container Service (ECS) with compute power managed by AWS Fargate compute engine. Recommended for applications that can be deployed as a container image. If your project does not contain a Dockerfile, one will be generated for the project.
Additional Deployments Options
Additional Deployment Options
------------------------------
2: ASP.NET Core App to AWS Elastic Beanstalk on Linux
Deploy an ASP.NET Core application to AWS Elastic Beanstalk. Recommended for applications that are not set up to be deployed as containers.
Expand Down
12 changes: 1 addition & 11 deletions src/AWS.Deploy.CLI/Commands/DeployCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,17 +299,7 @@ private async Task<Recommendation> GetSelectedRecommendationFromPreviousDeployme
selectedRecommendation
.Recipe
.OptionSettings
.Where(x =>
{
if (!selectedRecommendation.IsOptionSettingDisplayable(x))
return false;
var value = selectedRecommendation.GetOptionSettingValue(x);
if (value == null || value.ToString() == string.Empty)
return false;
return true;
})
.Where(x => selectedRecommendation.IsSummaryDisplayable(x))
.ToArray();

foreach (var setting in optionSettings)
Expand Down
2 changes: 1 addition & 1 deletion src/AWS.Deploy.CLI/ConsoleUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public Recommendation AskToChooseRecommendation(IList<Recommendation> recommenda

if (recommendations.Count > 1)
{
_interactiveService.WriteLine("Additional Deployments Options");
_interactiveService.WriteLine("Additional Deployment Options");
_interactiveService.WriteLine("------------------------------");
for (var index = 1; index < recommendations.Count; index++)
{
Expand Down
23 changes: 16 additions & 7 deletions src/AWS.Deploy.CLI/ServerMode/Controllers/DeploymentController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,11 @@ public async Task<IActionResult> GetRecommendations(string sessionId)
foreach (var recommendation in state.NewRecommendations)
{
output.Recommendations.Add(new RecommendationSummary(
recommendation.Recipe.Id,
recommendation.Name,
recommendation.ShortDescription
recipeId: recommendation.Recipe.Id,
name: recommendation.Name,
shortDescription: recommendation.ShortDescription,
description: recommendation.Description,
targetService: recommendation.Recipe.TargetService
));
}

Expand Down Expand Up @@ -187,6 +189,7 @@ private List<OptionSettingItemSummary> ListOptionSettingSummary(Recommendation r
Advanced = setting.AdvancedSetting,
ReadOnly = recommendation.IsExistingCloudApplication && !setting.Updatable,
Visible = recommendation.IsOptionSettingDisplayable(setting),
SummaryDisplayable = recommendation.IsSummaryDisplayable(setting),
AllowedValues = setting.AllowedValues,
ValueMapping = setting.ValueMapping,
ChildOptionSettings = ListOptionSettingSummary(recommendation, setting.ChildOptionSettings)
Expand Down Expand Up @@ -270,11 +273,17 @@ public async Task<IActionResult> GetExistingDeployments(string sessionId)

foreach(var deployment in state.ExistingDeployments)
{
var recommendation = state.NewRecommendations.First(x => string.Equals(x.Recipe.Id, deployment.RecipeId));

output.ExistingDeployments.Add(new ExistingDeploymentSummary(
deployment.Name,
deployment.RecipeId,
deployment.LastUpdatedTime,
deployment.UpdatedByCurrentUser));
name: deployment.Name,
recipeId: deployment.RecipeId,
recipeName: recommendation.Name,
shortDescription: recommendation.ShortDescription,
description: recommendation.Description,
targetService: recommendation.Recipe.TargetService,
lastUpdatedTime: deployment.LastUpdatedTime,
updatedByCurrentUser: deployment.UpdatedByCurrentUser));
}

return Ok(output);
Expand Down
16 changes: 16 additions & 0 deletions src/AWS.Deploy.CLI/ServerMode/Models/ExistingDeploymentSummary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,35 @@ public class ExistingDeploymentSummary

public string RecipeId { get; set; }

public string RecipeName { get; set; }

public string ShortDescription { get; set; }

public string Description { get; set; }

public string TargetService { get; set; }

public DateTime? LastUpdatedTime { get; set; }

public bool UpdatedByCurrentUser { get; set; }

public ExistingDeploymentSummary(
string name,
string recipeId,
string recipeName,
string shortDescription,
string description,
string targetService,
DateTime? lastUpdatedTime,
bool updatedByCurrentUser
)
{
Name = name;
RecipeId = recipeId;
RecipeName = recipeName;
ShortDescription = shortDescription;
Description = description;
TargetService = targetService;
LastUpdatedTime = lastUpdatedTime;
UpdatedByCurrentUser = updatedByCurrentUser;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public class OptionSettingItemSummary

public bool Visible { get; set; }

public bool SummaryDisplayable { get; set; }

public IList<string> AllowedValues { get; set; } = new List<string>();

public IDictionary<string, string> ValueMapping { get; set; } = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,23 @@ public class RecommendationSummary
{
public string RecipeId { get; set; }
public string Name { get; set; }
public string ShortDescription { get; set; }
public string Description { get; set; }
public string TargetService { get; set; }

public RecommendationSummary(
string recipeId,
string name,
string description
string shortDescription,
string description,
string targetService
)
{
RecipeId = recipeId;
Name = name;
ShortDescription = shortDescription;
Description = description;
TargetService = targetService;
}
}
}
15 changes: 15 additions & 0 deletions src/AWS.Deploy.Common/Recommendation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,5 +182,20 @@ public bool IsOptionSettingDisplayable(OptionSettingItem optionSetting)

return true;
}

/// <summary>
/// Checks whether the Option Setting Item can be displayed as part of the settings summary of the previous deployment.
/// </summary>
public bool IsSummaryDisplayable(OptionSettingItem optionSettingItem)
{
if (!IsOptionSettingDisplayable(optionSettingItem))
return false;

var value = GetOptionSettingValue(optionSettingItem);
if (string.IsNullOrEmpty(value?.ToString()))
return false;

return true;
}
}
}
21 changes: 21 additions & 0 deletions src/AWS.Deploy.ServerMode.Client/RestAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1415,6 +1415,18 @@ public partial class ExistingDeploymentSummary
[Newtonsoft.Json.JsonProperty("recipeId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string RecipeId { get; set; }

[Newtonsoft.Json.JsonProperty("recipeName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string RecipeName { get; set; }

[Newtonsoft.Json.JsonProperty("shortDescription", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string ShortDescription { get; set; }

[Newtonsoft.Json.JsonProperty("description", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Description { get; set; }

[Newtonsoft.Json.JsonProperty("targetService", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string TargetService { get; set; }

[Newtonsoft.Json.JsonProperty("lastUpdatedTime", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.DateTimeOffset? LastUpdatedTime { get; set; }

Expand Down Expand Up @@ -1524,6 +1536,9 @@ public partial class OptionSettingItemSummary
[Newtonsoft.Json.JsonProperty("visible", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public bool Visible { get; set; }

[Newtonsoft.Json.JsonProperty("summaryDisplayable", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public bool SummaryDisplayable { get; set; }

[Newtonsoft.Json.JsonProperty("allowedValues", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.Collections.Generic.ICollection<string> AllowedValues { get; set; }

Expand Down Expand Up @@ -1575,9 +1590,15 @@ public partial class RecommendationSummary
[Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Name { get; set; }

[Newtonsoft.Json.JsonProperty("shortDescription", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string ShortDescription { get; set; }

[Newtonsoft.Json.JsonProperty("description", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Description { get; set; }

[Newtonsoft.Json.JsonProperty("targetService", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string TargetService { get; set; }


}

Expand Down
25 changes: 24 additions & 1 deletion test/AWS.Deploy.CLI.IntegrationTests/ServerModeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,12 @@ public async Task GetRecommendations()

var getRecommendationOutput = await restClient.GetRecommendationsAsync(sessionId);
Assert.NotEmpty(getRecommendationOutput.Recommendations);
Assert.Equal("AspNetAppElasticBeanstalkLinux", getRecommendationOutput.Recommendations.FirstOrDefault().RecipeId);
var beanstalkRecommendation = getRecommendationOutput.Recommendations.FirstOrDefault();
Assert.Equal("AspNetAppElasticBeanstalkLinux", beanstalkRecommendation.RecipeId);
Assert.NotNull(beanstalkRecommendation.ShortDescription);
Assert.NotNull(beanstalkRecommendation.Description);
Assert.True(beanstalkRecommendation.ShortDescription.Length < beanstalkRecommendation.Description.Length);
Assert.Equal("AWS Elastic Beanstalk", beanstalkRecommendation.TargetService);
}
finally
{
Expand Down Expand Up @@ -212,6 +217,24 @@ public async Task WebFargateDeploymentNoConfigChanges()

Assert.True(logOutput.Length > 0);
Assert.Contains("Initiating deployment", logOutput.ToString());

var redeploymentSessionOutput = await restClient.StartDeploymentSessionAsync(new StartDeploymentSessionInput
{
AwsRegion = _awsRegion,
ProjectPath = projectPath
});

var redeploymentSessionId = redeploymentSessionOutput.SessionId;

var existingDeployments = await restClient.GetExistingDeploymentsAsync(redeploymentSessionId);
var existingDeployment = existingDeployments.ExistingDeployments.First(x => string.Equals(_stackName, x.Name));

Assert.Equal(_stackName, existingDeployment.Name);
Assert.Equal(fargateRecommendation.RecipeId, existingDeployment.RecipeId);
Assert.Equal(fargateRecommendation.Name, existingDeployment.RecipeName);
Assert.Equal(fargateRecommendation.ShortDescription, existingDeployment.ShortDescription);
Assert.Equal(fargateRecommendation.Description, existingDeployment.Description);
Assert.Equal(fargateRecommendation.TargetService, existingDeployment.TargetService);
}
finally
{
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "0.23",
"version": "0.24",
"publicReleaseRefSpec": [
".*"
],
Expand Down

0 comments on commit b1baf24

Please sign in to comment.