From d2907e08212a83f88cccc0b82c82808b5aed5fd2 Mon Sep 17 00:00:00 2001 From: Ben Broderick Phillips Date: Wed, 10 Jan 2024 16:28:43 -0500 Subject: [PATCH 1/2] Add package filter parameter to select recursively found packages in release --- .../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 5da9c29f55..2ba1075e95 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 07d8cd0ed5..172c3cf1ce 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:" From a25c89a721afaf984ee9e97115818c1c5d2a6aca Mon Sep 17 00:00:00 2001 From: Ben Broderick Phillips Date: Wed, 10 Jan 2024 17:40:58 -0500 Subject: [PATCH 2/2] Handle empty value for packageFilter --- .../pipelines/templates/steps/create-tags-and-git-release.yml | 2 +- 1 file changed, 1 insertion(+), 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 2ba1075e95..ed7c2e4202 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 @@ -15,7 +15,7 @@ steps: arguments: > -artifactLocation ${{ parameters.ArtifactLocation }} -packageRepository ${{ parameters.PackageRepository }} - -packageFilter ${{ parameters.PackageFilter }} + -packageFilter "${{ parameters.PackageFilter }}" -releaseSha ${{ parameters.ReleaseSha }} -repoId ${{ parameters.RepoId }} -workingDirectory '${{ parameters.WorkingDirectory }}'