Filter packages at verify step (#5275)

Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
This commit is contained in:
Azure SDK Bot 2024-01-16 16:06:48 -08:00 committed by GitHub
parent 2a4292f3ac
commit f548d1eabe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 11 deletions

View File

@ -68,7 +68,7 @@ function GetExistingTags($apiUrl) {
return ,@()
}
exit(1)
exit 1
}
}
@ -116,7 +116,7 @@ function RetrievePackages($artifactLocation) {
}
# Walk across all build artifacts, check them against the appropriate repository, return a list of tags/releases
function VerifyPackages($artifactLocation, $workingDirectory, $apiUrl, $releaseSha, $continueOnError = $false) {
function VerifyPackages($artifactLocation, $workingDirectory, $apiUrl, $releaseSha, $packageFilter, $continueOnError = $false) {
$pkgList = [array]@()
$pkgs, $parsePkgInfoFn = RetrievePackages -artifactLocation $artifactLocation
@ -128,10 +128,15 @@ function VerifyPackages($artifactLocation, $workingDirectory, $apiUrl, $releaseS
continue
}
if ($packageFilter -and $parsedPackage.PackageId -notlike $packageFilter) {
Write-Host "Skipping package $($parsedPackage.PackageId) not matching filter $packageFilter"
continue
}
if ($parsedPackage.Deployable -ne $True -and !$continueOnError) {
Write-Host "Package $($parsedPackage.PackageId) is marked with version $($parsedPackage.PackageVersion), the version $($parsedPackage.PackageVersion) has already been deployed to the target repository."
Write-Host "Maybe a pkg version wasn't updated properly?"
exit(1)
exit 1
}
$docsReadMeName = $parsedPackage.PackageId
if ($parsedPackage.DocsReadMeName) {
@ -150,7 +155,7 @@ function VerifyPackages($artifactLocation, $workingDirectory, $apiUrl, $releaseS
}
catch {
Write-Host $_.Exception.Message
exit(1)
exit 1
}
}
@ -197,6 +202,6 @@ function CheckArtifactShaAgainstTagsList($priorExistingTagList, $releaseSha, $ap
if ($unmatchedTags.Length -gt 0 -and !$continueOnError) {
Write-Host "Tags already existing with different SHA versions. Exiting."
exit(1)
exit 1
}
}

View File

@ -25,12 +25,7 @@ $apiUrl = "https://api.github.com/repos/$repoId"
Write-Host "Using API URL $apiUrl"
# VERIFY PACKAGES
$pkgList = VerifyPackages -artifactLocation $artifactLocation -workingDirectory $workingDirectory -apiUrl $apiUrl -releaseSha $releaseSha -continueOnError $continueOnError
if ($packageFilter) {
Write-Host "Filtering discovered packages to '$packageFilter'"
[array]$pkgList = $pkgList | Where-Object { $_.PackageId -like $packageFilter }
}
$pkgList = VerifyPackages -artifactLocation $artifactLocation -workingDirectory $workingDirectory -apiUrl $apiUrl -releaseSha $releaseSha -packageFilter $packageFilter -continueOnError $continueOnError
if ($pkgList) {
Write-Host "Given the visible artifacts, github releases will be created for the following:"