Skip to content

Commit 80b927e

Browse files
Copilotscbedd
andauthored
Fix scoped builds crashing on integration publishing (#46233)
* Fix scoped builds: check BuildTargetingString glob match instead of directory existence When BuildTargetingString is set, split it by comma and test each artifact name against the glob patterns using PowerShell -like before attempting to publish. Non-matching packages are skipped with a clear log message. Closes #42014 Agent-Logs-Url: https://github.com/Azure/azure-sdk-for-python/sessions/88e37a34-ffce-4971-91c0-223321039c44 Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: scbedd <45376673+scbedd@users.noreply.github.com>
1 parent 36cbc4b commit 80b927e

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

eng/pipelines/templates/stages/archetype-python-release.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,19 @@ stages:
387387
- ${{if ne(artifact.skipPublishDevFeed, 'true')}}:
388388

389389
- pwsh: |
390+
# If BuildTargetingString is set, check whether this artifact matches any of the
391+
# (possibly comma-separated) glob patterns before attempting to publish.
392+
# This handles scoped builds where only a subset of packages are built.
393+
$targetingString = $env:BUILDTARGETINGSTRING
394+
if ($targetingString) {
395+
$globs = $targetingString -split ","
396+
$isTargeted = $globs | Where-Object { "${{artifact.name}}" -like $_.Trim() }
397+
if (-not $isTargeted) {
398+
Write-Host "Package '${{artifact.name}}' does not match BuildTargetingString '$targetingString'. Skipping integration publish."
399+
exit 0
400+
}
401+
}
402+
390403
$fileCount = (Get-ChildItem $(Pipeline.Workspace)/${{parameters.ArtifactName}}/${{artifact.name}} | ? {$_.Name -match "-[0-9]*.[0-9]*.[0-9]*a[0-9]*" } | Measure-Object).Count
391404
392405
if ($fileCount -eq 0) {

0 commit comments

Comments
 (0)