From 623cec06ee8a4ae18fb86a7d5f0086811c77664c Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Thu, 11 Jan 2024 12:43:28 -0800 Subject: [PATCH] Sync eng/common directory with azure-sdk-tools for PR 7445 (#33789) * Add package filter parameter to select recursively found packages in release * Handle empty value for packageFilter --------- Co-authored-by: Ben Broderick Phillips --- .../templates/steps/create-tags-and-git-release.yml | 4 +++- eng/common/scripts/create-tags-and-git-release.ps1 | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/eng/common/pipelines/templates/steps/create-tags-and-git-release.yml b/eng/common/pipelines/templates/steps/create-tags-and-git-release.yml index 5da9c29f55a9..ed7c2e420208 100644 --- a/eng/common/pipelines/templates/steps/create-tags-and-git-release.yml +++ b/eng/common/pipelines/templates/steps/create-tags-and-git-release.yml @@ -1,6 +1,7 @@ parameters: ArtifactLocation: 'not-specified' PackageRepository: 'not-specified' + PackageFilter: '' ReleaseSha: 'not-specified' RepoId: $(Build.Repository.Name) WorkingDirectory: '' @@ -14,10 +15,11 @@ steps: arguments: > -artifactLocation ${{ parameters.ArtifactLocation }} -packageRepository ${{ parameters.PackageRepository }} + -packageFilter "${{ parameters.PackageFilter }}" -releaseSha ${{ parameters.ReleaseSha }} -repoId ${{ parameters.RepoId }} -workingDirectory '${{ parameters.WorkingDirectory }}' pwsh: true timeoutInMinutes: 5 env: - GH_TOKEN: $(azuresdk-github-pat) \ No newline at end of file + GH_TOKEN: $(azuresdk-github-pat) diff --git a/eng/common/scripts/create-tags-and-git-release.ps1 b/eng/common/scripts/create-tags-and-git-release.ps1 index 07d8cd0ed5bc..172c3cf1ce98 100644 --- a/eng/common/scripts/create-tags-and-git-release.ps1 +++ b/eng/common/scripts/create-tags-and-git-release.ps1 @@ -7,6 +7,7 @@ param ( $artifactLocation, # the root of the artifact folder. DevOps $(System.ArtifactsDirectory) $workingDirectory, # directory that package artifacts will be extracted into for examination (if necessary) $packageRepository, # used to indicate destination against which we will check the existing version. + $packageFilter, # valid options: PyPI, Nuget, NPM, Maven, C, CPP # used by CreateTags $releaseSha, # the SHA for the artifacts. DevOps: $(Release.Artifacts..SourceVersion) or $(Build.SourceVersion) @@ -26,6 +27,11 @@ 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 } +} + if ($pkgList) { Write-Host "Given the visible artifacts, github releases will be created for the following:"