Skip to content

Commit 61b21fa

Browse files
authored
Filter packages at verify step (#7536)
1 parent fdaf3dc commit 61b21fa

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

eng/common/scripts/artifact-metadata-parsing.ps1

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function GetExistingTags($apiUrl) {
6868
return ,@()
6969
}
7070

71-
exit(1)
71+
exit 1
7272
}
7373
}
7474

@@ -116,7 +116,7 @@ function RetrievePackages($artifactLocation) {
116116
}
117117

118118
# Walk across all build artifacts, check them against the appropriate repository, return a list of tags/releases
119-
function VerifyPackages($artifactLocation, $workingDirectory, $apiUrl, $releaseSha, $continueOnError = $false) {
119+
function VerifyPackages($artifactLocation, $workingDirectory, $apiUrl, $releaseSha, $packageFilter, $continueOnError = $false) {
120120
$pkgList = [array]@()
121121
$pkgs, $parsePkgInfoFn = RetrievePackages -artifactLocation $artifactLocation
122122

@@ -128,10 +128,15 @@ function VerifyPackages($artifactLocation, $workingDirectory, $apiUrl, $releaseS
128128
continue
129129
}
130130

131+
if ($packageFilter -and $parsedPackage.PackageId -notlike $packageFilter) {
132+
Write-Host "Skipping package $($parsedPackage.PackageId) not matching filter $packageFilter"
133+
continue
134+
}
135+
131136
if ($parsedPackage.Deployable -ne $True -and !$continueOnError) {
132137
Write-Host "Package $($parsedPackage.PackageId) is marked with version $($parsedPackage.PackageVersion), the version $($parsedPackage.PackageVersion) has already been deployed to the target repository."
133138
Write-Host "Maybe a pkg version wasn't updated properly?"
134-
exit(1)
139+
exit 1
135140
}
136141
$docsReadMeName = $parsedPackage.PackageId
137142
if ($parsedPackage.DocsReadMeName) {
@@ -150,7 +155,7 @@ function VerifyPackages($artifactLocation, $workingDirectory, $apiUrl, $releaseS
150155
}
151156
catch {
152157
Write-Host $_.Exception.Message
153-
exit(1)
158+
exit 1
154159
}
155160
}
156161

@@ -197,6 +202,6 @@ function CheckArtifactShaAgainstTagsList($priorExistingTagList, $releaseSha, $ap
197202

198203
if ($unmatchedTags.Length -gt 0 -and !$continueOnError) {
199204
Write-Host "Tags already existing with different SHA versions. Exiting."
200-
exit(1)
205+
exit 1
201206
}
202207
}

eng/common/scripts/create-tags-and-git-release.ps1

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,7 @@ $apiUrl = "https://api.github.com/repos/$repoId"
2525
Write-Host "Using API URL $apiUrl"
2626

2727
# VERIFY PACKAGES
28-
$pkgList = VerifyPackages -artifactLocation $artifactLocation -workingDirectory $workingDirectory -apiUrl $apiUrl -releaseSha $releaseSha -continueOnError $continueOnError
29-
30-
if ($packageFilter) {
31-
Write-Host "Filtering discovered packages to '$packageFilter'"
32-
[array]$pkgList = $pkgList | Where-Object { $_.PackageId -like $packageFilter }
33-
}
28+
$pkgList = VerifyPackages -artifactLocation $artifactLocation -workingDirectory $workingDirectory -apiUrl $apiUrl -releaseSha $releaseSha -packageFilter $packageFilter -continueOnError $continueOnError
3429

3530
if ($pkgList) {
3631
Write-Host "Given the visible artifacts, github releases will be created for the following:"

0 commit comments

Comments
 (0)