Skip to content

Commit e16fab7

Browse files
NoriZCwyunchi-ms
andauthored
[Pipleline] Generated sdk code verify (#22199)
* Gen code verify (#22080) * test the filechanges.txt location * do updates on Storage generated file * do updates on Storage generated file * try path * test path * test path * convert updated gen * Gen code verify (#22085) * test the filechanges.txt location * do updates on Storage generated file * do updates on Storage generated file * try path * test path * test path * convert updated gen * comment test * add debug log * add debug log * add debug log * add debug log * clean * for test * for test * friday test * friday test * friday test * friday test * friday test * friday test * friday test * friday test * friday test * Saturday test * Add ux * Uncomment test steps * Resolve comments * Resolve comments * Resolve comments * Resolve comments * Test for unknown exception * Test for unknown exception * Test for unknown exception * Test for unknown exception * Test for unknown exception * Test for unknown exception * Test for unknown exception * Test for unknown exception * Test for unknown exception * Test for unknown exception * Test for unknown exception * Rename generated sdk verification step in Static Analysis --------- Co-authored-by: wyunchi-ms <[email protected]>
1 parent 580d38d commit e16fab7

File tree

9 files changed

+23
-22
lines changed

9 files changed

+23
-22
lines changed

.ci-config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"src/{ModuleName}/{ModuleName}.Sdk/Generated/*"
88
],
99
"phases": [
10-
"verify-gensdk:module"
10+
"generated-sdk:module"
1111
]
1212
},
1313
{

tools/BuildPackagesTask/Microsoft.Azure.Build.Tasks/CIFilterTask.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public class CIFilterTask : Task
7070

7171
private const string BUILD_PHASE = "build";
7272
private const string TEST_PHASE = "test";
73-
private readonly List<string> ANALYSIS_PHASE_LIST = new List<string>() { "breaking-change", "help-example", "help", "dependency", "signature", "file-change", "ux", "verify-gensdk" };
73+
private readonly List<string> ANALYSIS_PHASE_LIST = new List<string>() { "breaking-change", "help-example", "help", "dependency", "signature", "file-change", "ux", "generated-sdk" };
7474
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.
7575
private const string ACCOUNT_MODULE_NAME = "Accounts";
7676

tools/ExecuteCIStep.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Param(
6363
$StaticAnalysisCmdletDiff,
6464

6565
[Switch]
66-
$StaticAnalysisVerifyGensdk,
66+
$StaticAnalysisGeneratedSdk,
6767

6868
[String]
6969
$RepoArtifacts='artifacts',
@@ -400,7 +400,7 @@ If ($StaticAnalysis)
400400
.("$PSScriptRoot/ExecuteCIStep.ps1") -StaticAnalysisHelp @Parameters
401401
.("$PSScriptRoot/ExecuteCIStep.ps1") -StaticAnalysisUX @Parameters
402402
.("$PSScriptRoot/ExecuteCIStep.ps1") -StaticAnalysisCmdletDiff @Parameters
403-
.("$PSScriptRoot/ExecuteCIStep.ps1") -StaticAnalysisVerifyGensdk @Parameters
403+
.("$PSScriptRoot/ExecuteCIStep.ps1") -StaticAnalysisGeneratedSdk @Parameters
404404
Return
405405
}
406406

@@ -512,17 +512,17 @@ If ($StaticAnalysisCmdletDiff)
512512
Return
513513
}
514514

515-
If ($StaticAnalysisVerifyGensdk)
515+
If ($StaticAnalysisGeneratedSdk)
516516
{
517517
If ($PSBoundParameters.ContainsKey("TargetModule"))
518518
{
519-
$VerifyGenSdkModuleList = $TargetModule
519+
$GeneratedSdkModuleList = $TargetModule
520520
}
521521
Else
522522
{
523-
$VerifyGenSdkModuleList = Join-String -Separator ';' -InputObject $CIPlan.'verify-gensdk'
523+
$GeneratedSdkModuleList = Join-String -Separator ';' -InputObject $CIPlan.'generated-sdk'
524524
}
525-
If ("" -Ne $VerifyGenSdkModuleList)
525+
If ("" -Ne $GeneratedSdkModuleList)
526526
{
527527
Write-Host "Running static analysis to verify generated sdk..."
528528
$result = .($PSScriptRoot + "/StaticAnalysis/GeneratedSdkAnalyzer/SDKGeneratedCodeVerify.ps1")

tools/PipelineResultTemplate.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
"Details": [
4848
]
4949
},
50-
"verify-gensdk": {
51-
"PhaseName": "Verify Generated Sdk",
50+
"generated-sdk": {
51+
"PhaseName": "Generated Sdk Check",
5252
"Order": 9,
5353
"Details": [
5454
]

tools/StaticAnalysis/CollectStaticAnalysisPipelineResult.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ $Steps = @(
7373
IssuePath = "$StaticAnalysisOutputDirectory/UXMetadataIssues.csv"
7474
},
7575
@{
76-
PhaseName = "verify-gensdk"
77-
IssuePath = "$StaticAnalysisOutputDirectory/VerifyGensdkIssues.csv"
76+
PhaseName = "generated-sdk"
77+
IssuePath = "$StaticAnalysisOutputDirectory/GeneratedSdkIssues.csv"
7878
}
7979
)
8080

@@ -151,7 +151,7 @@ ForEach ($Step In $Steps) {
151151
ElseIf ($PhaseName -Eq "ux") {
152152
$Content = "|Type|Module|ResourceType|SubResourceType|Command|Description|`n|---|---|---|---|---|---|`n"
153153
}
154-
ElseIf ($PhaseName -Eq "verify-gensdk") {
154+
ElseIf ($PhaseName -Eq "generated-sdk") {
155155
$Content = "|Type|Module|Sdk|Description|Remediation|`n|---|---|---|---|---|`n"
156156
}
157157
#EndRegion
@@ -173,7 +173,7 @@ ForEach ($Step In $Steps) {
173173
ElseIf ($PhaseName -Eq "ux") {
174174
$Content += "|$ErrorTypeEmoji|$($Issue.Module)|$($Issue.ResourceType)|$($Issue.SubResourceType)|$($Issue.Command)|$($Issue.Description)|`n"
175175
}
176-
ElseIf ($PhaseName -Eq "verify-gensdk") {
176+
ElseIf ($PhaseName -Eq "generated-sdk") {
177177
$Content += "|$ErrorTypeEmoji|$($Issue.Module)|$($Issue.Sdk)|$($Issue.Description)|$($Issue.Remediation)|`n"
178178
}
179179
#EndRegion

tools/StaticAnalysis/GeneratedSdkAnalyzer/VerifyGenSdkIssue.cs renamed to tools/StaticAnalysis/GeneratedSdkAnalyzer/GeneratedSdkIssue.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
namespace StaticAnalysis.GeneratedSdkAnalyzer
2020
{
21-
public class VerifyGenSdkIssue : IReportRecord
21+
public class GeneratedSdkIssue : IReportRecord
2222
{
2323
/// <summary>
2424
/// The module containing the generated sdk issue
@@ -46,7 +46,7 @@ public string FormatRecord()
4646
public bool Match(IReportRecord other)
4747
{
4848
var result = false;
49-
var record = other as VerifyGenSdkIssue;
49+
var record = other as GeneratedSdkIssue;
5050
if (record != null)
5151
{
5252
result = string.Equals(record.Module, Module, StringComparison.OrdinalIgnoreCase) &&
@@ -64,7 +64,7 @@ public IReportRecord Parse(string line)
6464
var match = Regex.Match(line, matcher);
6565
if (!match.Success || match.Groups.Count < 7)
6666
{
67-
throw new InvalidOperationException(string.Format("Could not parse '{0}' as VerifyGenSdkIssue record", line));
67+
throw new InvalidOperationException(string.Format("Could not parse '{0}' as GeneratedSdkIssue record", line));
6868
}
6969

7070
Module = match.Groups[1].Value;

tools/StaticAnalysis/GeneratedSdkAnalyzer/SDKGeneratedCodeVerify.ps1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
$ArtifactsFolder = "$PSScriptRoot/../../../artifacts"
1717
$FilesChangedPaths = "$ArtifactsFolder/FilesChanged.txt"
18-
$ExceptionFilePath = "$ArtifactsFolder/StaticAnalysisResults/VerifyGenSdkIssues.csv"
18+
$ExceptionFilePath = "$ArtifactsFolder/StaticAnalysisResults/GeneratedSdkIssues.csv"
1919

2020
Class GeneratedSdkIssue {
2121
[String]$Module
@@ -52,7 +52,8 @@ try{
5252
autorest --reset
5353
foreach ($_ in $ChangedSdks) {
5454
# Extract Module Name
55-
$ModuleName = ($_ -split "\/|\\")[1]
55+
$ModuleName = "Az." + ($_ -split "\/|\\")[1]
56+
5657
# Direct to the Sdk directory
5758
Write-Host "Directing to " "$PSScriptRoot/../../../$_"
5859
cd "$PSScriptRoot/../../../$_"

tools/StaticAnalysis/IssueChecker/IssueChecker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class IssueChecker : IStaticAnalyzer
4444
("SignatureIssues.csv", typeof(SignatureIssue).FullName),
4545
("ExampleIssues.csv", typeof(ExampleIssue).FullName),
4646
("UXMetadataIssues.csv", typeof(UXMetadataIssue).FullName),
47-
("VerifyGenSdkIssues.csv", typeof(VerifyGenSdkIssue).FullName)
47+
("GeneratedSdkIssues.csv", typeof(GeneratedSdkIssue).FullName)
4848
};
4949
public AnalysisLogger Logger { get; set; }
5050

tools/StaticAnalysis/ReportRecordFactory.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ public static IReportRecord Create(string type)
6969
{
7070
return new UXMetadataIssue();
7171
}
72-
if (type.Equals(typeof(VerifyGenSdkIssue).FullName))
72+
if (type.Equals(typeof(GeneratedSdkIssue).FullName))
7373
{
74-
return new VerifyGenSdkIssue();
74+
return new GeneratedSdkIssue();
7575
}
7676

7777
return null;

0 commit comments

Comments
 (0)