Releases to vcpkg tag codeowners (#2825)
* Attempt tagging of @danieljurek in PRBody * Attempt to assign reviewers * Use codeowners, filter out groups, use a default owner, add comments to issue. * Move variables to right level of config * Set PrOwners variable * Remove PR owners, requires admin permissions * Escape DevOps variable to expand into string * Add AuthToken * Tweak portfile and codeowners to validate multiple artifact scenario * Revert "Tweak portfile and codeowners to validate multiple artifact scenario" This reverts commit bcc7a36119c7f399f1b079f51889d6ff0d499142. * Review feedback * Validate fallback logic * Deal with empty list of owners * Revert "Validate fallback logic" This reverts commit ade2dff5a7d9cac9bb61fdc0f92cd50412b7c31c.
This commit is contained in:
parent
99ff3b04bd
commit
af44672837
@ -95,6 +95,10 @@ stages:
|
||||
name: azsdk-pool-mms-win-2019-general
|
||||
vmImage: MMS2019
|
||||
|
||||
variables:
|
||||
VcpkgPrRepoOwner: Microsoft
|
||||
VcpkgPrRepoName: vcpkg
|
||||
|
||||
strategy:
|
||||
runOnce:
|
||||
deploy:
|
||||
@ -103,7 +107,7 @@ stages:
|
||||
|
||||
- pwsh: |
|
||||
$branchName = "azure-sdk-for-cpp-${{ artifact.Name }}-$(Build.BuildId)"
|
||||
if ('$(VcpkgForkBranchName)') {
|
||||
if ('$(VcpkgForkBranchName)') {
|
||||
Write-Host "Using queue time branch name"
|
||||
$branchName = '$(VcpkgForkBranchName)'
|
||||
}
|
||||
@ -153,8 +157,8 @@ stages:
|
||||
# (which is already done by Update-VcpkgPort.ps1)
|
||||
- template: /eng/common/pipelines/templates/steps/create-pull-request.yml
|
||||
parameters:
|
||||
RepoOwner: Microsoft
|
||||
RepoName: vcpkg
|
||||
RepoOwner: $(VcpkgPrRepoOwner)
|
||||
RepoName: $(VcpkgPrRepoName)
|
||||
WorkingDirectory: $(Pipeline.Workspace)/vcpkg
|
||||
PrBranchName: $(PrBranchName)
|
||||
PRTitle: $(PrTitle)
|
||||
@ -165,6 +169,58 @@ stages:
|
||||
PRLabels: "auto-merge"
|
||||
CloseAfterOpenForTesting: '${{ parameters.TestPipeline }}'
|
||||
|
||||
- pwsh: |
|
||||
# "person1,person2,Azure/group-name,person3" ->
|
||||
# "@person1, @person2, @person3"
|
||||
function getFormattedNotifableOwners($rawOwners) {
|
||||
# If the list of owners is empty return an emtpy
|
||||
# string
|
||||
if (!$rawOwners) {
|
||||
return ''
|
||||
}
|
||||
|
||||
$owners = @()
|
||||
foreach ($owner in $rawOwners -split ',') {
|
||||
# Exclude groups. GitHub does not notify teams
|
||||
# that have different owners (e.g. alerting
|
||||
# @Azure/example-team when opening a PR in
|
||||
# Microsoft/vcpkg)
|
||||
if ($owner.indexOf('/') -ne -1) {
|
||||
continue
|
||||
}
|
||||
|
||||
$owners += "@$owner"
|
||||
}
|
||||
return $owners -join ', '
|
||||
}
|
||||
|
||||
$prOwners = $(Build.SourcesDirectory)/eng/common/scripts/get-codeowners.ps1 `
|
||||
-TargetDirectory "/sdk/${{ parameters.ServiceDirectory }}/" `
|
||||
-RootDirectory "$(Build.SourcesDirectory)"
|
||||
|
||||
$codeOwnersToNotify = getFormattedNotifableOwners -rawOwners $prOwners
|
||||
|
||||
# If there are no codeowners fall back to owners of /sdk/
|
||||
if (!$codeOwnersToNotify) {
|
||||
$fallbackOwners = $(Build.SourcesDirectory)/eng/common/scripts/get-codeowners.ps1 `
|
||||
-TargetDirectory "/sdk/" `
|
||||
-RootDirectory "$(Build.SourcesDirectory)"
|
||||
$codeOwnersToNotify = getFormattedNotifableOwners -rawOwners $fallbackOwners
|
||||
}
|
||||
|
||||
$prComment = "Adding ${{ artifact.Name }} to release"
|
||||
if ($codeOwnersToNotify) {
|
||||
$prComment += "`n`ncc: $codeOwnersToNotify"
|
||||
}
|
||||
|
||||
./eng/common/scripts/Add-IssueComment.ps1 `
|
||||
-AuthToken "$(azuresdk-github-pat)" `
|
||||
-RepoOwner $(VcpkgPrRepoOwner) `
|
||||
-RepoName $(VcpkgPrRepoName) `
|
||||
-IssueNumber "$(Submitted.PullRequest.Number)" `
|
||||
-Comment $prComment
|
||||
displayName: Comment notification to PR
|
||||
|
||||
- ${{if ne(artifact.skipUpdatePackageVersion, 'true')}}:
|
||||
- deployment: UpdatePackageVersion
|
||||
displayName: "Update Package Version"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user