Skip to content

Commit

Permalink
Filter packages at verify step (#22252)
Browse files Browse the repository at this point in the history
Co-authored-by: Ben Broderick Phillips <[email protected]>
  • Loading branch information
2 people authored and chlowell committed Jan 17, 2024
1 parent 375fab3 commit 972591a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
15 changes: 10 additions & 5 deletions eng/common/scripts/artifact-metadata-parsing.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function GetExistingTags($apiUrl) {
return ,@()
}

exit(1)
exit 1
}
}

Expand Down Expand Up @@ -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

Expand All @@ -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) {
Expand All @@ -150,7 +155,7 @@ function VerifyPackages($artifactLocation, $workingDirectory, $apiUrl, $releaseS
}
catch {
Write-Host $_.Exception.Message
exit(1)
exit 1
}
}

Expand Down Expand Up @@ -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
}
}
7 changes: 1 addition & 6 deletions eng/common/scripts/create-tags-and-git-release.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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:"
Expand Down

0 comments on commit 972591a

Please sign in to comment.