Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Pipleline] Generated sdk code verify #22199

Merged
merged 38 commits into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
b623589
Gen code verify (#22080)
NoriZC Jun 15, 2023
a2c0ea4
Gen code verify (#22085)
NoriZC Jun 15, 2023
5c4c4b5
add debug log
NoriZC Jun 15, 2023
bad134a
add debug log
NoriZC Jun 15, 2023
ff65c94
add debug log
NoriZC Jun 15, 2023
e7a1d21
add debug log
NoriZC Jun 15, 2023
fb90726
clean
NoriZC Jun 15, 2023
56dd38c
for test
NoriZC Jun 15, 2023
4a50598
for test
NoriZC Jun 16, 2023
e3af1d9
friday test
NoriZC Jun 16, 2023
7f9f06d
friday test
NoriZC Jun 16, 2023
c3800ea
friday test
NoriZC Jun 16, 2023
47d736d
friday test
NoriZC Jun 16, 2023
412ed42
friday test
NoriZC Jun 16, 2023
695ae9d
friday test
NoriZC Jun 16, 2023
90f92ac
friday test
NoriZC Jun 16, 2023
7503e88
friday test
NoriZC Jun 16, 2023
a1bc21e
friday test
NoriZC Jun 17, 2023
be5090b
Saturday test
NoriZC Jun 17, 2023
9a39259
Add ux
NoriZC Jun 17, 2023
74b2a95
Uncomment test steps
NoriZC Jun 17, 2023
5280ad3
Resolve comments
NoriZC Jun 27, 2023
e95a6a3
Resolve comments
NoriZC Jun 27, 2023
473350a
Resolve comments
NoriZC Jun 28, 2023
4c07174
Resolve comments
NoriZC Jun 28, 2023
8482ade
Test for unknown exception
wyunchi-ms Jun 28, 2023
cbacc5e
Test for unknown exception
wyunchi-ms Jun 28, 2023
7e91eaa
Test for unknown exception
wyunchi-ms Jun 28, 2023
5c7e615
Test for unknown exception
wyunchi-ms Jun 28, 2023
fdf003d
Test for unknown exception
wyunchi-ms Jun 28, 2023
e100154
Test for unknown exception
wyunchi-ms Jun 28, 2023
b3256d5
Test for unknown exception
wyunchi-ms Jun 28, 2023
b1c96d6
Test for unknown exception
wyunchi-ms Jun 28, 2023
70ebe96
Test for unknown exception
wyunchi-ms Jun 29, 2023
f42c8c4
Test for unknown exception
wyunchi-ms Jun 29, 2023
efaea4e
Test for unknown exception
wyunchi-ms Jun 29, 2023
7bed9ff
Merge branch 'main' into nori/gen-code-verify
NoriZC Jun 29, 2023
1960ca7
Rename generated sdk verification step in Static Analysis
NoriZC Jun 30, 2023
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
2 changes: 1 addition & 1 deletion .ci-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"src/{ModuleName}/{ModuleName}.Sdk/Generated/*"
],
"phases": [
"verify-gensdk:module"
"generated-sdk:module"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public class CIFilterTask : Task

private const string BUILD_PHASE = "build";
private const string TEST_PHASE = "test";
private readonly List<string> ANALYSIS_PHASE_LIST = new List<string>() { "breaking-change", "help-example", "help", "dependency", "signature", "file-change", "ux", "verify-gensdk" };
private readonly List<string> ANALYSIS_PHASE_LIST = new List<string>() { "breaking-change", "help-example", "help", "dependency", "signature", "file-change", "ux", "generated-sdk" };
private readonly List<string> ONLY_AFFECT_MODULE_PHASE_LIST = new List<string>() { "cmdlet-diff" }; // These phases will be triggered only when the module is modified, not when its dependent module is updated.
private const string ACCOUNT_MODULE_NAME = "Accounts";

Expand Down
12 changes: 6 additions & 6 deletions tools/ExecuteCIStep.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Param(
$StaticAnalysisCmdletDiff,

[Switch]
$StaticAnalysisVerifyGensdk,
$StaticAnalysisGeneratedSdk,

[String]
$RepoArtifacts='artifacts',
Expand Down Expand Up @@ -400,7 +400,7 @@ If ($StaticAnalysis)
.("$PSScriptRoot/ExecuteCIStep.ps1") -StaticAnalysisHelp @Parameters
.("$PSScriptRoot/ExecuteCIStep.ps1") -StaticAnalysisUX @Parameters
.("$PSScriptRoot/ExecuteCIStep.ps1") -StaticAnalysisCmdletDiff @Parameters
.("$PSScriptRoot/ExecuteCIStep.ps1") -StaticAnalysisVerifyGensdk @Parameters
.("$PSScriptRoot/ExecuteCIStep.ps1") -StaticAnalysisGeneratedSdk @Parameters
Return
}

Expand Down Expand Up @@ -512,17 +512,17 @@ If ($StaticAnalysisCmdletDiff)
Return
}

If ($StaticAnalysisVerifyGensdk)
If ($StaticAnalysisGeneratedSdk)
{
If ($PSBoundParameters.ContainsKey("TargetModule"))
{
$VerifyGenSdkModuleList = $TargetModule
$GeneratedSdkModuleList = $TargetModule
}
Else
{
$VerifyGenSdkModuleList = Join-String -Separator ';' -InputObject $CIPlan.'verify-gensdk'
$GeneratedSdkModuleList = Join-String -Separator ';' -InputObject $CIPlan.'generated-sdk'
}
If ("" -Ne $VerifyGenSdkModuleList)
If ("" -Ne $GeneratedSdkModuleList)
{
Write-Host "Running static analysis to verify generated sdk..."
$result = .($PSScriptRoot + "/StaticAnalysis/GeneratedSdkAnalyzer/SDKGeneratedCodeVerify.ps1")
Expand Down
4 changes: 2 additions & 2 deletions tools/PipelineResultTemplate.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
"Details": [
]
},
"verify-gensdk": {
"PhaseName": "Verify Generated Sdk",
"generated-sdk": {
"PhaseName": "Generated Sdk Check",
"Order": 9,
"Details": [
]
Expand Down
8 changes: 4 additions & 4 deletions tools/StaticAnalysis/CollectStaticAnalysisPipelineResult.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ $Steps = @(
IssuePath = "$StaticAnalysisOutputDirectory/UXMetadataIssues.csv"
},
@{
PhaseName = "verify-gensdk"
IssuePath = "$StaticAnalysisOutputDirectory/VerifyGensdkIssues.csv"
PhaseName = "generated-sdk"
IssuePath = "$StaticAnalysisOutputDirectory/GeneratedSdkIssues.csv"
}
)

Expand Down Expand Up @@ -151,7 +151,7 @@ ForEach ($Step In $Steps) {
ElseIf ($PhaseName -Eq "ux") {
$Content = "|Type|Module|ResourceType|SubResourceType|Command|Description|`n|---|---|---|---|---|---|`n"
}
ElseIf ($PhaseName -Eq "verify-gensdk") {
ElseIf ($PhaseName -Eq "generated-sdk") {
$Content = "|Type|Module|Sdk|Description|Remediation|`n|---|---|---|---|---|`n"
}
#EndRegion
Expand All @@ -173,7 +173,7 @@ ForEach ($Step In $Steps) {
ElseIf ($PhaseName -Eq "ux") {
$Content += "|$ErrorTypeEmoji|$($Issue.Module)|$($Issue.ResourceType)|$($Issue.SubResourceType)|$($Issue.Command)|$($Issue.Description)|`n"
}
ElseIf ($PhaseName -Eq "verify-gensdk") {
ElseIf ($PhaseName -Eq "generated-sdk") {
$Content += "|$ErrorTypeEmoji|$($Issue.Module)|$($Issue.Sdk)|$($Issue.Description)|$($Issue.Remediation)|`n"
}
#EndRegion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

namespace StaticAnalysis.GeneratedSdkAnalyzer
{
public class VerifyGenSdkIssue : IReportRecord
public class GeneratedSdkIssue : IReportRecord
{
/// <summary>
/// The module containing the generated sdk issue
Expand Down Expand Up @@ -46,7 +46,7 @@ public string FormatRecord()
public bool Match(IReportRecord other)
{
var result = false;
var record = other as VerifyGenSdkIssue;
var record = other as GeneratedSdkIssue;
if (record != null)
{
result = string.Equals(record.Module, Module, StringComparison.OrdinalIgnoreCase) &&
Expand All @@ -64,7 +64,7 @@ public IReportRecord Parse(string line)
var match = Regex.Match(line, matcher);
if (!match.Success || match.Groups.Count < 7)
{
throw new InvalidOperationException(string.Format("Could not parse '{0}' as VerifyGenSdkIssue record", line));
throw new InvalidOperationException(string.Format("Could not parse '{0}' as GeneratedSdkIssue record", line));
}

Module = match.Groups[1].Value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

$ArtifactsFolder = "$PSScriptRoot/../../../artifacts"
$FilesChangedPaths = "$ArtifactsFolder/FilesChanged.txt"
$ExceptionFilePath = "$ArtifactsFolder/StaticAnalysisResults/VerifyGenSdkIssues.csv"
$ExceptionFilePath = "$ArtifactsFolder/StaticAnalysisResults/GeneratedSdkIssues.csv"

Class GeneratedSdkIssue {
[String]$Module
Expand Down Expand Up @@ -52,7 +52,8 @@ try{
autorest --reset
foreach ($_ in $ChangedSdks) {
# Extract Module Name
$ModuleName = ($_ -split "\/|\\")[1]
$ModuleName = "Az." + ($_ -split "\/|\\")[1]

# Direct to the Sdk directory
Write-Host "Directing to " "$PSScriptRoot/../../../$_"
cd "$PSScriptRoot/../../../$_"
Expand Down
2 changes: 1 addition & 1 deletion tools/StaticAnalysis/IssueChecker/IssueChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class IssueChecker : IStaticAnalyzer
("SignatureIssues.csv", typeof(SignatureIssue).FullName),
("ExampleIssues.csv", typeof(ExampleIssue).FullName),
("UXMetadataIssues.csv", typeof(UXMetadataIssue).FullName),
("VerifyGenSdkIssues.csv", typeof(VerifyGenSdkIssue).FullName)
("GeneratedSdkIssues.csv", typeof(GeneratedSdkIssue).FullName)
};
public AnalysisLogger Logger { get; set; }

Expand Down
4 changes: 2 additions & 2 deletions tools/StaticAnalysis/ReportRecordFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ public static IReportRecord Create(string type)
{
return new UXMetadataIssue();
}
if (type.Equals(typeof(VerifyGenSdkIssue).FullName))
if (type.Equals(typeof(GeneratedSdkIssue).FullName))
{
return new VerifyGenSdkIssue();
return new GeneratedSdkIssue();
}

return null;
Expand Down