Skip to content

Commit f5051c4

Browse files
scbeddhallipr
andauthored
Further Tuning to net - pullrequest (Azure#48269)
* we need to support track1 exclusions separately from override file exclusions * the 'get additional validation packages for pr' is resolving deleted files and excluding any paths under exclude paths now * tune the language-settings to properly handle shared packages that have been changed Co-authored-by: Patrick Hallisey <[email protected]>
1 parent dcf55cf commit f5051c4

File tree

4 files changed

+42
-14
lines changed

4 files changed

+42
-14
lines changed

eng/pipelines/templates/jobs/ci.tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ jobs:
171171
/p:EnableSourceLink=false
172172
/p:ProjectListOverrideFile=$(ProjectListOverrideFile)
173173
/p:EnableOverrideExclusions=true
174+
/p:RemoveTrack1Projects=true
174175
$(AdditionalTestArguments)
175176
$(DiagnosticArguments)
176177
displayName: "Build & Test ($(TestTargetFramework))"

eng/pipelines/templates/jobs/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ jobs:
137137
/p:ArtifactsPackagesDir=$(Build.ArtifactStagingDirectory) `
138138
/p:ServiceDirectory=* `
139139
/p:ProjectListOverrideFile=$(ProjectListOverrideFile) `
140+
/p:IncludePerf=false `
141+
/p:IncludeStress=false `
142+
/p:EnableOverrideExclusions=true `
140143
$(DiagnosticArguments)
141144
displayName: "Build and Package for PR"
142145
- ${{ else }}:

eng/scripts/Language-Settings.ps1

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ function Get-dotnet-AdditionalValidationPackagesFromPackageSet {
148148
)
149149
$additionalValidationPackages = @()
150150
$uniqueResultSet = @()
151-
152151
function isOther($fileName) {
153152
$startsWithPrefixes = @(".config", ".devcontainer", ".github", ".vscode", "common", "doc", "eng", "samples")
154153

@@ -162,23 +161,42 @@ function Get-dotnet-AdditionalValidationPackagesFromPackageSet {
162161
return $startsWith
163162
}
164163

165-
# this section will identify the list of packages that we should treat as
166-
# "directly" changed for a given service level change. While that doesn't
167-
# directly change a package within the service, I do believe we should directly include all
168-
# packages WITHIN that service. This is because the service level file changes are likely to
169-
# have an impact on the packages within that service.
164+
# ensure we observe deleted files too
165+
$targetedFiles = @($diffObj.ChangedFiles + $diffObj.DeletedFiles)
166+
167+
# The targetedFiles needs to filter out anything in the ExcludePaths
168+
# otherwise it'll end up processing things below that it shouldn't be.
169+
foreach ($excludePath in $diffObj.ExcludePaths) {
170+
$targetedFiles = $targetedFiles | Where-Object { -not $_.StartsWith($excludePath) }
171+
}
172+
173+
# this section will identify
174+
# - any service-level changes
175+
# - any shared package changes that should be treated as a service-level change. EG changes to Azure.Storage.Shared.
176+
# and add all packages within that service to the validation set. these will be treated as "directly" changed packages.
170177
$changedServices = @()
171-
if ($diffObj.ChangedFiles) {
172-
foreach($file in $diffObj.ChangedFiles) {
178+
if ($targetedFiles) {
179+
foreach($file in $targetedFiles) {
173180
$pathComponents = $file -split "/"
174-
# handle changes only in sdk/<service>/<file>/<extension>
181+
# handle changes only in sdk/<service>/<file>.<extension>
175182
if ($pathComponents.Length -eq 3 -and $pathComponents[0] -eq "sdk") {
176-
$changedServices += $pathComponents[1]
183+
if (-not $changedServices.Contains($pathComponents[1])) {
184+
$changedServices += $pathComponents[1]
185+
}
177186
}
178187

179188
# handle any changes under sdk/<file>.<extension>
180189
if ($pathComponents.Length -eq 2 -and $pathComponents[0] -eq "sdk") {
181-
$changedServices += "template"
190+
if (-not $changedServices.Contains("template")) {
191+
$changedServices += "template"
192+
}
193+
}
194+
195+
# changes to a Azure.*.Shared within a service directory should include all packages within that service directory
196+
if ($file.Replace('\', '/') -match ".*sdk/.*/.*\.Shared/.*") {
197+
if (-not $changedServices.Contains($pathComponents[1])) {
198+
$changedServices += $pathComponents[1]
199+
}
182200
}
183201
}
184202
foreach ($changedService in $changedServices) {
@@ -195,9 +213,10 @@ function Get-dotnet-AdditionalValidationPackagesFromPackageSet {
195213
}
196214
}
197215

216+
# handle any changes to files that are not within a package directory
198217
$othersChanged = @()
199-
if ($diffObj.ChangedFiles) {
200-
$othersChanged = $diffObj.ChangedFiles | Where-Object { isOther($_) }
218+
if ($targetedFiles) {
219+
$othersChanged = $targetedFiles | Where-Object { isOther($_) }
201220
}
202221

203222
if ($othersChanged) {
@@ -208,6 +227,8 @@ function Get-dotnet-AdditionalValidationPackagesFromPackageSet {
208227
$additionalValidationPackages += $additionalPackages
209228
}
210229

230+
# walk the packages added purely for validation, if they haven't been added yet, add them
231+
# these packages aren't considered "directly" changed, so we will set IncludedForValidation to true for them
211232
foreach ($pkg in $additionalValidationPackages) {
212233
if ($uniqueResultSet -notcontains $pkg -and $LocatedPackages -notcontains $pkg) {
213234
$pkg.IncludedForValidation = $true

eng/service.proj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,13 @@
6161
<Import Project="..\sdk\$(ServiceDirectory)\*.projects" />
6262
<Import Project="$(RepoRoot)$(ProjectListOverrideFile)" Condition="'$(ProjectListOverrideFile)' != '' " />
6363

64-
<ItemGroup Condition="'$(ProjectListOverrideFile)' != '' and '$(EnableOverrideExclusions)' != ''">
64+
<ItemGroup Condition="'$(ProjectListOverrideFile)' != '' and '$(RemoveTrack1Projects)' == 'true'">
6565
<!-- Remove all track1 SDKs from Regen -->
6666
<Track1ProjectsToRemove Include="$(MSBuildThisFileDirectory)..\sdk\*\Microsoft.*.Management.*\**\*.csproj;$(MSBuildThisFileDirectory)..\sdk\*mgmt*\**\*.csproj;$(MSBuildThisFileDirectory)..\sdk\*\Microsoft.Azure.*\**\*.csproj" />
6767
<ProjectReference Remove="@(Track1ProjectsToRemove)" />
68+
</ItemGroup>
69+
70+
<ItemGroup Condition="'$(ProjectListOverrideFile)' != '' and '$(EnableOverrideExclusions)' != ''">
6871
<TestProjects Include="..\sdk\$(ServiceDirectory)\$(Project)\tests\**\*.csproj" Exclude="@(MgmtExcludePaths)" />
6972
<SamplesProjects Include="..\sdk\$(ServiceDirectory)\$(Project)\samples\**\*.csproj;..\sdk\$(ServiceDirectory)\samples\**\*.csproj" Exclude="@(MgmtExcludePaths)" />
7073
<PerfProjects Include="..\sdk\$(ServiceDirectory)\$(Project)\perf\**\*.csproj" Exclude="@(MgmtExcludePaths)" />

0 commit comments

Comments
 (0)