Skip to content

Commit

Permalink
Handle service specific changes as direct package updates (Azure#38091)
Browse files Browse the repository at this point in the history
* handle service specific changes as direct package updates
  • Loading branch information
scbedd authored Oct 25, 2024
1 parent c400ce2 commit 260412c
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions eng/scripts/Language-Settings.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function Get-python-AdditionalValidationPackagesFromPackageSet {
$AllPkgProps
)
$additionalValidationPackages = @()
$uniqueResultSet = @()

function isOther($fileName) {
$startsWithPrefixes = @(".config", ".devcontainer", ".github", ".vscode", "common", "conda", "doc", "eng", "scripts")
Expand All @@ -33,6 +34,11 @@ function Get-python-AdditionalValidationPackagesFromPackageSet {
return $startsWith
}

# this section will identify the list of packages that we should treat as
# "directly" changed for a given service level change. While that doesn't
# directly change a package within the service, I do believe we should directly include all
# packages WITHIN that service. This is because the service level file changes are likely to
# have an impact on the packages within that service.
$changedServices = @()
foreach($file in $diffObj.ChangedFiles) {
$pathComponents = $file -split "/"
Expand All @@ -46,6 +52,18 @@ function Get-python-AdditionalValidationPackagesFromPackageSet {
changedServices += "template"
}
}
foreach ($changedService in $changedServices) {
$additionalPackages = $AllPkgProps | Where-Object { $_.ServiceDirectory -eq $changedService }

foreach ($pkg in $additionalPackages) {
if ($uniqueResultSet -notcontains $pkg -and $LocatedPackages -notcontains $pkg) {
# notice the lack of setting IncludedForValidation to true. This is because these "changed services"
# are specifically where a file within the service, but not an individual package within that service has changed.
# we want this package to be fully validated
$uniqueResultSet += $pkg
}
}
}

$toolChanged = $diffObj.ChangedFiles | Where-Object { $_.StartsWith("tool")}
$engChanged = $diffObj.ChangedFiles | Where-Object { $_.StartsWith("eng")}
Expand Down Expand Up @@ -88,12 +106,7 @@ function Get-python-AdditionalValidationPackagesFromPackageSet {
$additionalValidationPackages += $additionalPackages
}

foreach ($changedService in $changedServices) {
$additionalPackages = $AllPkgProps | Where-Object { $_.ServiceDirectory -eq $changedService }
$additionalValidationPackages += $additionalPackages
}

$uniqueResultSet = @()
foreach ($pkg in $additionalValidationPackages) {
if ($uniqueResultSet -notcontains $pkg -and $LocatedPackages -notcontains $pkg) {
$pkg.IncludedForValidation = $true
Expand Down

0 comments on commit 260412c

Please sign in to comment.