diff --git a/eng/common/scripts/artifact-metadata-parsing.ps1 b/eng/common/scripts/artifact-metadata-parsing.ps1 index bfdf6edfd12a..0dacb2ddf83c 100644 --- a/eng/common/scripts/artifact-metadata-parsing.ps1 +++ b/eng/common/scripts/artifact-metadata-parsing.ps1 @@ -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 } } diff --git a/eng/common/scripts/create-tags-and-git-release.ps1 b/eng/common/scripts/create-tags-and-git-release.ps1 index 172c3cf1ce98..51e5f28815c4 100644 --- a/eng/common/scripts/create-tags-and-git-release.ps1 +++ b/eng/common/scripts/create-tags-and-git-release.ps1 @@ -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:"