Skip to content

Commit 4bede1d

Browse files
committed
Merge remote-tracking branch 'origin/master' into mark-net6
2 parents 4e25d94 + c671b18 commit 4bede1d

29 files changed

+1103
-96
lines changed

.github/workflows/dotnet-core.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ jobs:
1313

1414
steps:
1515
- uses: actions/checkout@v2
16+
- name: Check for secrets leak on the repo
17+
run: |
18+
git clone https://github.com/awslabs/git-secrets.git target
19+
cd target
20+
sudo make install
21+
echo "Git-secrets installation completed"
22+
git secrets --register-aws --global
23+
echo "Added aws secret templates"
24+
git secrets --scan -r ../
25+
echo "Repository scan completed"
1626
- name: Setup .NET Core
1727
uses: actions/setup-dotnet@v1
1828
with:

NuGet.Config

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<packageSources>
4+
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
5+
<add key="dotnet" value="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
6+
<add key="encore-nuget" value="https://s3-us-west-2.amazonaws.com/aws.portingassistant.dotnet.download/nuget/index.json" />
7+
</packageSources>
8+
</configuration>

RecommendationTools/RecommendationBatchUpdater/RecommendationBatchUpdater.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
55
<TargetFramework>netcoreapp3.1</TargetFramework>
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="CTA.Rules.Models" Version="1.10.16-alpha-gcdfac9e409" />
9+
<PackageReference Include="CTA.Rules.Models" Version="2.0.3" />
1010
</ItemGroup>
1111

1212
<ItemGroup>

RecommendationTools/RecommendationTools.sln

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
Microsoft Visual Studio Solution File, Format Version 12.00
2-
# Visual Studio Version 16
3-
VisualStudioVersion = 16.0.31729.503
2+
# Visual Studio Version 17
3+
VisualStudioVersion = 17.0.32126.317
44
MinimumVisualStudioVersion = 10.0.40219.1
55
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RecommendationValidator", "RecommendationValidator\RecommendationValidator.csproj", "{DB3D0373-8483-4CEB-96C1-F1B0966D7483}"
66
EndProject
7-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RecommendationBatchUpdater", "RecommendationBatchUpdater\RecommendationBatchUpdater.csproj", "{BAE409F1-F59A-458C-8F94-D4ED943A4E79}"
7+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RecommendationBatchUpdater", "RecommendationBatchUpdater\RecommendationBatchUpdater.csproj", "{BAE409F1-F59A-458C-8F94-D4ED943A4E79}"
8+
EndProject
9+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PostSyncTests", "UnitTests\PostSyncTests.csproj", "{853E9367-AAFE-4CEA-9FAD-867BD09BB978}"
810
EndProject
911
Global
1012
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -20,6 +22,10 @@ Global
2022
{BAE409F1-F59A-458C-8F94-D4ED943A4E79}.Debug|Any CPU.Build.0 = Debug|Any CPU
2123
{BAE409F1-F59A-458C-8F94-D4ED943A4E79}.Release|Any CPU.ActiveCfg = Release|Any CPU
2224
{BAE409F1-F59A-458C-8F94-D4ED943A4E79}.Release|Any CPU.Build.0 = Release|Any CPU
25+
{853E9367-AAFE-4CEA-9FAD-867BD09BB978}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
26+
{853E9367-AAFE-4CEA-9FAD-867BD09BB978}.Debug|Any CPU.Build.0 = Debug|Any CPU
27+
{853E9367-AAFE-4CEA-9FAD-867BD09BB978}.Release|Any CPU.ActiveCfg = Release|Any CPU
28+
{853E9367-AAFE-4CEA-9FAD-867BD09BB978}.Release|Any CPU.Build.0 = Release|Any CPU
2329
EndGlobalSection
2430
GlobalSection(SolutionProperties) = preSolution
2531
HideSolutionNode = FALSE
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net5.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
7+
<IsPackable>false</IsPackable>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="AWSSDK.S3" Version="3.7.7.23" />
12+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
13+
<PackageReference Include="NUnit" Version="3.13.2" />
14+
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0" />
15+
<PackageReference Include="coverlet.collector" Version="3.1.0" />
16+
</ItemGroup>
17+
18+
</Project>
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
using NUnit.Framework;
2+
using System;
3+
using System.IO;
4+
using System.IO.Compression;
5+
using System.Linq;
6+
using System.Net.Http;
7+
using System.Threading.Tasks;
8+
9+
namespace PostSyncTests
10+
{
11+
/// <summary>
12+
/// These tests are made to be run automatically after a merge and sync to the public S3 bucket. This is needed
13+
/// in order to validate that the public S3 bucket is up to date with the repository and that the sync is working.
14+
/// If running these tests in a feature branch with changes to the recommendation files, the tests should fail.
15+
/// </summary>
16+
public class S3SyncTests
17+
{
18+
private const string S3UrlPrefix = "https://s3.us-west-2.amazonaws.com/aws.portingassistant.dotnet.datastore/recommendationsync/recommendation";
19+
private const string TempExtractDir = "masterBranchCode";
20+
21+
[TearDown]
22+
[SetUp]
23+
public static void SetupAndTearDown()
24+
{
25+
if (Directory.Exists(TempExtractDir))
26+
{
27+
Directory.Delete(TempExtractDir, true);
28+
}
29+
}
30+
31+
[Test]
32+
public async Task ValidateS3RecommendationContentMatchesRepository()
33+
{
34+
using var httpClient = new HttpClient();
35+
// Use always master branch since that is the only branch that should be in sync with S3
36+
var zipBytes = await httpClient.GetByteArrayAsync("https://github.com/aws/porting-assistant-dotnet-datastore/archive/refs/heads/master.zip");
37+
await File.WriteAllBytesAsync("github.zip", zipBytes);
38+
Directory.CreateDirectory(TempExtractDir);
39+
ZipFile.ExtractToDirectory("github.zip", "masterBranchCode");
40+
var pathToRepoRecs = $@"{TempExtractDir}\porting-assistant-dotnet-datastore-master\recommendation";
41+
42+
var allRepoRecs = Directory.EnumerateFiles(pathToRepoRecs).ToList();
43+
44+
Assert.Multiple(async () =>
45+
{
46+
foreach(var file in allRepoRecs)
47+
{
48+
var s3ObjectPath = $"{S3UrlPrefix}/{file.Split('\\').Last()}";
49+
var s3Content = await httpClient.GetStringAsync(s3ObjectPath);
50+
var localContent = await File.ReadAllTextAsync(file);
51+
localContent = localContent.Replace("\r\n", "\n", StringComparison.Ordinal);
52+
s3Content = s3Content.Replace("\r\n", "\n", StringComparison.Ordinal);
53+
Assert.AreEqual(localContent, s3Content, $"Content didn't match for file {file}");
54+
}
55+
});
56+
}
57+
}
58+
}

Templates/default.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
"Name": "AspNetWebApiFeature",
1818
"ClassName": "AspNetWebApiFeature"
1919
},
20+
{
21+
"Name": "AspNetWebFormsFeature",
22+
"ClassName": "AspNetWebFormsFeature"
23+
},
2024
{
2125
"Name": "AspNetCoreMvcFeature",
2226
"ClassName": "AspNetCoreMvcFeature"

Templates/monolithservice/MonolithService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
using System.Web.Configuration;
1111
using System.Web.Routing;
1212
13-
namespace Modernize.Web.Mvc.Controllers
13+
namespace #NAMESPACEPLACEHOLDER#
1414
{
1515
public static class MonolithService
1616
{

hooks/commit-msg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env bash
2+
git secrets --commit_msg_hook -- "$@"

hooks/pre-commit

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env bash
2+
git secrets --pre_commit_hook -- "$@"

0 commit comments

Comments
 (0)