From da7e2d49df96b4ecaac00d49c1724f7289ed5c12 Mon Sep 17 00:00:00 2001 From: Azure CLI Bot Date: Wed, 20 Nov 2024 10:03:40 +0800 Subject: [PATCH] {CI} Sync resourceManagement.yml according To ADO Wiki Page - Service Contact List (#8288) * {CI} Sync resourceManagement.yml alias pipeline * create pr against main branch * Sync resourceManagement.yml --------- Co-authored-by: Qi Pan <43341456+Pan-Qi@users.noreply.github.com> --- .azure-pipelines/sync-alias.yml | 92 +++ .github/policies/resourceManagement.yml | 591 +++++++++++++++--- .../automation/ParseServiceContactsList.ps1 | 132 ++++ 3 files changed, 717 insertions(+), 98 deletions(-) create mode 100644 .azure-pipelines/sync-alias.yml create mode 100644 scripts/automation/ParseServiceContactsList.ps1 diff --git a/.azure-pipelines/sync-alias.yml b/.azure-pipelines/sync-alias.yml new file mode 100644 index 00000000000..3720577c8e0 --- /dev/null +++ b/.azure-pipelines/sync-alias.yml @@ -0,0 +1,92 @@ +name: Azure CLI Sync Alias + +schedules: +- cron: "50 15 * * 0" + displayName: 11:50 PM (UTC + 8:00) China Weekly Run + branches: + include: + - main + +# The 'resources' and 'uses' below are used to resolve the error 'Repository associated with wiki ID does not exist or you do not have permissions for the operation you are attempting.' +resources: + repositories: + - repository: ServiceContactList + type: git + name: internal.wiki + +jobs: +- job: UpdateYaml + displayName: Update resourceManagement.yml + pool: pool-windows-2019 + uses: + repositories: + - ServiceContactList + + steps: + - task: UseDotNet@2 + displayName: Install .NET 8 SDK + inputs: + packageType: sdk + version: 8.0.x + + - pwsh: | + dotnet --version + dotnet new tool-manifest --force + dotnet tool install powershell --version 7.4.* + displayName: Install PowerShell 7.4.x + + - pwsh: | + dotnet tool run pwsh -NoLogo -NoProfile -NonInteractive -File ./scripts/automation/ParseServiceContactsList.ps1 -AccessToken $env:SYSTEM_ACCESSTOKEN + env: + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + displayName: Update resourceManagement.yml file locally + + - pwsh: | + $hasChanges = git diff --name-only .github/policies + if ($null -eq $hasChanges) { + Write-Host "The wiki has no changes." + Write-Host "##vso[task.setvariable variable=ChangesDetected]false" + } else { + Write-Host "There are changes in the repository." + Write-Host "##vso[task.setvariable variable=ChangesDetected]true" + } + displayName: Check if Wiki table has any changes + + - task: AzurePowerShell@5 + inputs: + pwsh: true + azureSubscription: '$(AZURE_SDK_INFRA_SUB_CONNECTED_SERVICE)' + ScriptType: 'InlineScript' + Inline: | + $GithubToken = Get-AzKeyVaultSecret -VaultName $(GithubPATKeyVaultName) -Name $(GithubPATKeyVaultAccount) -AsPlainText + Write-Host "##vso[task.setvariable variable=GithubToken;issecret=true]$GithubToken" + azurePowerShellVersion: 'LatestVersion' + displayName: Get Github PAT from Key Vault + + - pwsh: | + git config --global user.email "AzPyCLI@microsoft.com" + git config --global user.name "Azure CLI Team" + git checkout -b "sync_alias_$env:Build_BuildId" + + git add .github/policies + git commit -m "Sync resourceManagement.yml" + + git remote set-url origin https://azclibot:$(GithubToken)@github.com/Azure/azure-cli-extensions.git; + git push origin "sync_alias_$env:Build_BuildId" --force + displayName: Git commit and push + condition: and(succeeded(), eq(variables['ChangesDetected'], 'true')) + + - pwsh: | + $Title = "{CI} Sync resourceManagement.yml according To ADO Wiki Page - Service Contact List" + $HeadBranch = "sync_alias_$env:Build_BuildId" + $BaseBranch = "main" + $Description = "This PR synchronizes the task: 'Triage issues to the service team' part of resourceManagement.yml from table of Service Contact List in ADO wiki page" + + $Headers = @{"Accept" = "application/vnd.github+json"; "Authorization" = "Bearer $(GithubToken)" } + $RequestBody = @{"title" = $Title; "body" = $Description; "head" = $HeadBranch; "base" = $BaseBranch;} + $Uri = "https://api.github.com/repos/Azure/azure-cli-extensions/pulls" + + Invoke-WebRequest -Uri $Uri -Method POST -Headers $Headers -Body ($RequestBody | ConvertTo-Json) + + displayName: Create PR to main branch + condition: and(succeeded(), eq(variables['ChangesDetected'], 'true')) diff --git a/.github/policies/resourceManagement.yml b/.github/policies/resourceManagement.yml index b45a3a041c9..3084fabbe4c 100644 --- a/.github/policies/resourceManagement.yml +++ b/.github/policies/resourceManagement.yml @@ -1,10 +1,10 @@ -id: +id: name: GitOps.PullRequestIssueManagement description: GitOps.PullRequestIssueManagement primitive -owner: +owner: resource: repository disabled: false -where: +where: configuration: resourceManagementConfiguration: scheduledSearches: @@ -241,6 +241,7 @@ configuration: mentionees: - mojayara - jportugal0 + - pkrishnanms replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False - if: @@ -268,6 +269,17 @@ configuration: - yairgil replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: Amg + then: + - mentionUsers: + mentionees: + - ABZhang0 + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False - if: - hasLabel: label: Service Attention @@ -277,7 +289,6 @@ configuration: - mentionUsers: mentionees: - athipp - - taiwu - minghan replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False @@ -330,6 +341,30 @@ configuration: - azmonapplicationinsights replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: Appservice-kube + then: + - mentionUsers: + mentionees: + - Juliehzl + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: Arc enabled servers + then: + - mentionUsers: + mentionees: + - rpsqrd + - edyoung + - vedkale + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False - if: - hasLabel: label: Service Attention @@ -377,6 +412,18 @@ configuration: - MSEvanhi replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: ARM - Management Group + then: + - mentionUsers: + mentionees: + - rthorn17 + - daxfohl + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False - if: - hasLabel: label: Service Attention @@ -422,6 +469,17 @@ configuration: - Azure/deployments-owners replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: arm-bicep + then: + - mentionUsers: + mentionees: + - Azure/deployments-owners + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False - if: - hasLabel: label: Service Attention @@ -436,6 +494,19 @@ configuration: - amanohar replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: ASTRO + then: + - mentionUsers: + mentionees: + - Reshmi-Sriram + - banggaurav + - charanjeet2008 + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False - if: - hasLabel: label: Service Attention @@ -488,27 +559,26 @@ configuration: - hasLabel: label: Service Attention - hasLabel: - label: Azure Arc enabled servers + label: Azure Data Explorer then: - mentionUsers: mentionees: - - rpsqrd - - edyoung + - ilayrn + - orhasban + - zoharHenMicrosoft + - sagivf + - Aviv-Yaniv replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False - if: - hasLabel: label: Service Attention - hasLabel: - label: Azure Data Explorer + label: Azure Deployments then: - mentionUsers: mentionees: - - ilayrn - - orhasban - - zoharHenMicrosoft - - sagivf - - Aviv-Yaniv + - Azure/deployments-owners replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False - if: @@ -561,7 +631,7 @@ configuration: then: - mentionUsers: mentionees: - - matthchr + - pradeepgunda replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False - if: @@ -573,6 +643,7 @@ configuration: - mentionUsers: mentionees: - cabbpt + - theelderwand replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False - if: @@ -587,6 +658,17 @@ configuration: - filizt replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: Bootstrapper + then: + - mentionUsers: + mentionees: + - bganapa + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False - if: - hasLabel: label: Service Attention @@ -598,6 +680,17 @@ configuration: - sgellock replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: Cloud Service (Ext) + then: + - mentionUsers: + mentionees: + - hirenshah1 + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False - if: - hasLabel: label: Service Attention @@ -606,7 +699,18 @@ configuration: then: - mentionUsers: mentionees: - - maertendMSFT + - mbifeld + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: CloudService + then: + - mentionUsers: + mentionees: + - bberera replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False - if: @@ -692,6 +796,7 @@ configuration: mentionees: - ctstone - anrothMSFT + - yungshinlintw replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False - if: @@ -796,6 +901,20 @@ configuration: - swmachan replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: Cognitive Services + then: + - mentionUsers: + mentionees: + - gxy001 + - yangyuan + - tianxin-ms + - xiaomin-ms + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False - if: - hasLabel: label: Service Attention @@ -914,6 +1033,17 @@ configuration: - sandeepraichura replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: confcom + then: + - mentionUsers: + mentionees: + - SethHollandsworth + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False - if: - hasLabel: label: Service Attention @@ -936,6 +1066,28 @@ configuration: - akashkeshari replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: ConnectedMachine + then: + - mentionUsers: + mentionees: + - raghushantha + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: connectedvmware + then: + - mentionUsers: + mentionees: + - nascarsayan + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False - if: - hasLabel: label: Service Attention @@ -1035,6 +1187,7 @@ configuration: - toddysm - luisdlp - northtyphoon + - terencet-dev replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False - if: @@ -1059,7 +1212,8 @@ configuration: then: - mentionUsers: mentionees: - - calvinsID + - howang-ms + - Greedygre replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False - if: @@ -1184,7 +1338,8 @@ configuration: then: - mentionUsers: mentionees: - - arindamc + - edwinc + - mvvsubbu replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False - if: @@ -1230,7 +1385,7 @@ configuration: then: - mentionUsers: mentionees: - - idear1203 + - MikeRys replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False - if: @@ -1328,6 +1483,18 @@ configuration: - hiaga replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: DesktopVirtualization + then: + - mentionUsers: + mentionees: + - alec-baird + - costinhagiu + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False - if: - hasLabel: label: Service Attention @@ -1383,7 +1550,8 @@ configuration: then: - mentionUsers: mentionees: - - Tanmayeekamath + - anishtrakru + - derekbekoe replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False - if: @@ -1398,6 +1566,29 @@ configuration: - inesk-vt replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: DnsResolver + then: + - mentionUsers: + mentionees: + - arpit-gagneja + - jotrivet + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: ElasticSan + then: + - mentionUsers: + mentionees: + - blueww + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False - if: - hasLabel: label: Service Attention @@ -1420,6 +1611,17 @@ configuration: - Saglodha replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: fleet + then: + - mentionUsers: + mentionees: + - Ealianis + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False - if: - hasLabel: label: Service Attention @@ -1466,7 +1668,6 @@ configuration: - mentionUsers: mentionees: - aim-for-better - - idear1203 - deshriva replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False @@ -1482,6 +1683,19 @@ configuration: - omzevall replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: ImageBuilder + then: + - mentionUsers: + mentionees: + - adana-popescu + - KalpeshChavan12 + - ralucaminea + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False - if: - hasLabel: label: Service Attention @@ -1536,8 +1750,7 @@ configuration: then: - mentionUsers: mentionees: - - rkmanda - - chieftn + - Elsie4ever,MohinderAtwal replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False - if: @@ -1550,7 +1763,8 @@ configuration: mentionees: - RandalliLama - schaabs - - jlichwa + - chen-karen + - chandanrr replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False - if: @@ -1561,7 +1775,8 @@ configuration: then: - mentionUsers: mentionees: - - NarayanThiru + - bavneetsingh16 + - ramyasreechakka replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False - if: @@ -1575,6 +1790,17 @@ configuration: - Tanmayeekamath replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: load + then: + - mentionUsers: + mentionees: + - Himanshu49 + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False - if: - hasLabel: label: Service Attention @@ -1630,6 +1856,31 @@ configuration: - aashishb replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: Machine Learning Services + then: + - mentionUsers: + mentionees: + - paulshealy1 + - seanyao1 + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: Maintenance + then: + - mentionUsers: + mentionees: + - adana-popescu + - KalpeshChavan12 + - ralucaminea + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False - if: - hasLabel: label: Service Attention @@ -1638,7 +1889,7 @@ configuration: then: - mentionUsers: mentionees: - - varunkch + - RamyaElangovanP replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False - if: @@ -1652,6 +1903,18 @@ configuration: - Lighthouse-Azure replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: Management Groups + then: + - mentionUsers: + mentionees: + - rthorn17 + - cemheren + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False - if: - hasLabel: label: Service Attention @@ -1675,6 +1938,19 @@ configuration: - savjani replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: Marketplace + then: + - mentionUsers: + mentionees: + - saviesacov + - gupele + - mikamine + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False - if: - hasLabel: label: Service Attention @@ -1862,17 +2138,6 @@ configuration: - rastala replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False - - if: - - hasLabel: - label: Service Attention - - hasLabel: - label: Mobile Engagement - then: - - mentionUsers: - mentionees: - - kpiteira - replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. - assignMentionees: False - if: - hasLabel: label: Service Attention @@ -2012,6 +2277,17 @@ configuration: - rajsell replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: NetApp Files + then: + - mentionUsers: + mentionees: + - audunn + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False - if: - hasLabel: label: Service Attention @@ -2042,6 +2318,7 @@ configuration: then: - mentionUsers: mentionees: + - isamorris - bastionsuppgithub replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False @@ -2099,7 +2376,9 @@ configuration: then: - mentionUsers: mentionees: - - fwsuppgithub + - gopimsft + - gimotwanMSFT + - avripintoms replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False - if: @@ -2216,6 +2495,17 @@ configuration: - vpngwsuppgithub replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: Nginx + then: + - mentionUsers: + mentionees: + - limingu + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False - if: - hasLabel: label: Service Attention @@ -2224,8 +2514,8 @@ configuration: then: - mentionUsers: mentionees: - - tjsomasundaram - - aimankhan + - sreehari-ms + - vivekkhare31 replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False - if: @@ -2239,6 +2529,20 @@ configuration: - AzmonLogA replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: Oracle + then: + - mentionUsers: + mentionees: + - v-rvilathurs + - v-jamcheung + - v-eelhomsi + - v-adhenry + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False - if: - hasLabel: label: Service Attention @@ -2270,9 +2574,9 @@ configuration: then: - mentionUsers: mentionees: - - sunilagarwal - - sr-msft - - niklarin + - gbowerman + - jasomaning + - nachoalonsoportillo replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False - if: @@ -2283,8 +2587,9 @@ configuration: then: - mentionUsers: mentionees: - - daeunyim - - rajsell + - gbowerman + - jasomaning + - nachoalonsoportillo replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False - if: @@ -2310,6 +2615,19 @@ configuration: - ricardo-espinoza replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: Quota + then: + - mentionUsers: + mentionees: + - gyprakas + - rahuls-microsoft + - devatula + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False - if: - hasLabel: label: Service Attention @@ -2318,8 +2636,7 @@ configuration: then: - mentionUsers: mentionees: - - pvrk - - adityabalaji-msft + - Daya-Patil replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False - if: @@ -2387,7 +2704,7 @@ configuration: then: - mentionUsers: mentionees: - - chiragg4u + - venu-l replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False - if: @@ -2424,6 +2741,17 @@ configuration: - alzimmermsft replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: scvmm + then: + - mentionUsers: + mentionees: + - hsurana06 + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False - if: - hasLabel: label: Service Attention @@ -2432,7 +2760,6 @@ configuration: then: - mentionUsers: mentionees: - - brjohnstmsft - bleroy - tjacobhi - markheff @@ -2447,7 +2774,7 @@ configuration: then: - mentionUsers: mentionees: - - zivraf + - keren-shani replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False - if: @@ -2461,6 +2788,17 @@ configuration: - nazang replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: SelfHelp + then: + - mentionUsers: + mentionees: + - kenabd + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False - if: - hasLabel: label: Service Attention @@ -2483,6 +2821,18 @@ configuration: - Saglodha replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: Service Connector + then: + - mentionUsers: + mentionees: + - yungezz + - houk-ms + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False - if: - hasLabel: label: Service Attention @@ -2599,6 +2949,28 @@ configuration: - azureSQLGitHub replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: SSH + then: + - mentionUsers: + mentionees: + - vthiebaut10 + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: StackHCIVM + then: + - mentionUsers: + mentionees: + - arc-enabled-vms-on-hci Team + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False - if: - hasLabel: label: Service Attention @@ -2610,6 +2982,18 @@ configuration: - xgithubtriage replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: StorageSync + then: + - mentionUsers: + mentionees: + - ankushbindlish2 + - afedyashov + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False - if: - hasLabel: label: Service Attention @@ -2670,7 +3054,7 @@ configuration: then: - mentionUsers: mentionees: - - wonner + - wanyang7 - v-yanjungao replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False @@ -2682,7 +3066,7 @@ configuration: then: - mentionUsers: mentionees: - - klaaslanghout + - bberera replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False - if: @@ -2696,6 +3080,17 @@ configuration: - Shipra1Mishra replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. assignMentionees: False + - if: + - hasLabel: + label: Service Attention + - hasLabel: + label: Traffic Collector + then: + - mentionUsers: + mentionees: + - rmodh + replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}. + assignMentionees: False - if: - hasLabel: label: Service Attention @@ -3890,51 +4285,51 @@ configuration: - jsntcy description: '[ logic ] Notify to review Update index.json PR' - if: - - payloadType: Issues - - or: - - titleContains: - pattern: az \b(logic)\b - isRegex: True - - bodyContains: - pattern: az \b(logic)\b - isRegex: True - - or: - - isAction: - action: Opened - then: - - addLabel: - label: Logic App - - addLabel: - label: Auto-Assign - - assignTo: - users: - - ReaNAiveD - - zhoxing-ms - description: '[Logic] auto assign labels and users based on issue description.' - - if: - - payloadType: Pull_Request + - payloadType: Issues + - or: + - titleContains: + pattern: az \b(logic)\b + isRegex: True + - bodyContains: + pattern: az \b(logic)\b + isRegex: True + - or: - isAction: action: Opened - - or: - - titleContains: - pattern: '\b(logic|LOGIC)\b' - isRegex: True - - bodyContains: - pattern: az \b(logic)\b - isRegex: True - then: - - addLabel: - label: Auto-Assign - - addLabel: - label: Logic App - - requestReview: - reviewer: zhoxing-ms - - requestReview: - reviewer: ReaNAiveD - - assignTo: - users: - - zhoxing-ms - - ReaNAiveD + then: + - addLabel: + label: Logic App + - addLabel: + label: Auto-Assign + - assignTo: + users: + - ReaNAiveD + - zhoxing-ms + description: '[Logic] auto assign labels and users based on issue description.' + - if: + - payloadType: Pull_Request + - isAction: + action: Opened + - or: + - titleContains: + pattern: '\b(logic|LOGIC)\b' + isRegex: True + - bodyContains: + pattern: az \b(logic)\b + isRegex: True + then: + - addLabel: + label: Auto-Assign + - addLabel: + label: Logic App + - requestReview: + reviewer: zhoxing-ms + - requestReview: + reviewer: ReaNAiveD + - assignTo: + users: + - zhoxing-ms + - ReaNAiveD description: '[logic] Auto assign labels and reviewers based on PR title/description.' - if: - payloadType: Pull_Request @@ -6373,10 +6768,10 @@ configuration: action: Opened - or: - titleContains: - pattern: 'k8s-runtime' + pattern: k8s-runtime isRegex: True - bodyContains: - pattern: 'k8s-runtime' + pattern: k8s-runtime isRegex: True then: - addLabel: @@ -6389,5 +6784,5 @@ configuration: users: - ReaNAiveD description: '[k8s-runtime] Auto assign labels and reviewers based on PR title/description.' -onFailure: -onSuccess: +onFailure: +onSuccess: diff --git a/scripts/automation/ParseServiceContactsList.ps1 b/scripts/automation/ParseServiceContactsList.ps1 new file mode 100644 index 00000000000..a8c80f03042 --- /dev/null +++ b/scripts/automation/ParseServiceContactsList.ps1 @@ -0,0 +1,132 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.SYNOPSIS + Sync ADO Wiki Service Contact List to resourceManagement.yml. + +#> +param( + [Parameter(Mandatory = $true)] + [string] $AccessToken +) + +function InitializeRequiredPackages { + [CmdletBinding()] + param () + + $packagesDirectoryName = "JsonYamlPackages" + $packagesDirectory = Join-Path -Path . -ChildPath $packagesDirectoryName + if (Test-Path -LiteralPath $packagesDirectory) { + Remove-Item -LiteralPath $packagesDirectory -Recurse -Force + } + + New-Item -Path . -Name $packagesDirectoryName -ItemType Directory -Force + + $requiredPackages = @( + @{ PackageName = "Newtonsoft.Json"; PackageVersion = "13.0.2"; DllName = "Newtonsoft.Json.dll" }, + @{ PackageName = "YamlDotNet"; PackageVersion = "13.2.0"; DllName = "YamlDotNet.dll" } + ) + + $requiredPackages | ForEach-Object { + $packageName = $_["PackageName"] + $packageVersion = $_["PackageVersion"] + $packageDll = $_["DllName"] + Install-Package -Name $packageName -RequiredVersion $packageVersion -Source "https://www.nuget.org/api/v2" -Destination $packagesDirectory -SkipDependencies -ExcludeVersion -Force + Add-Type -LiteralPath (Join-Path -Path $packagesDirectory -ChildPath $packageName | Join-Path -ChildPath "lib" | Join-Path -ChildPath "net6.0" | Join-Path -ChildPath $packageDll) -ErrorAction SilentlyContinue + } +} + +# get wiki content +$username = "" +$password = $AccessToken +$pair = "{0}:{1}" -f ($username, $password) +$bytes = [System.Text.Encoding]::ASCII.GetBytes($pair) +$token = [System.Convert]::ToBase64String($bytes) +$headers = @{ + Authorization = "Basic {0}" -f ($token) +} + +$response = Invoke-RestMethod 'https://dev.azure.com/azclitools/internal/_apis/wiki/wikis/internal.wiki/pages?path=/Service%20Contact%20List&includeContent=true' -Headers $headers -ErrorAction Stop +$contactsList = ($response.content -split "\n") | Where-Object { $_ -like '|*' } | Select-Object -Skip 2 + +if ($null -ne $contactsList) { + $idxServiceTeamLabel = 2 + $idxCLINotifyGithubHandler = 5 + $serviceContacts = [System.Collections.Generic.SortedList[System.String, PSCustomObject]]::new() + + foreach ($contacts in $contactsList) { + $items = $contacts -split "\|" + $colServiceTeamLabel = $items[$idxServiceTeamLabel] + if (![string]::IsNullOrWhiteSpace($colServiceTeamLabel)) { + $serviceTeamLabel = $colServiceTeamLabel.Trim() + $colCLINotifyGithubHandler = $items[$idxCLINotifyGithubHandler] + + if (![string]::IsNullOrWhiteSpace($colCLINotifyGithubHandler)) { + $CLINotifyGithubHandler = $colCLINotifyGithubHandler.Trim() + [array]$mentionees = $CLINotifyGithubHandler.Split(",", [StringSplitOptions]::RemoveEmptyEntries) | ForEach-Object { + $_.Trim() + } + + $serviceContacts.Add($serviceTeamLabel, [PSCustomObject]@{ + if = @( + [PSCustomObject]@{ + hasLabel = [PSCustomObject]@{ + label = 'Service Attention' + } + }, + [PSCustomObject]@{ + hasLabel = [PSCustomObject]@{ + label = $serviceTeamLabel + } + } + ) + then = @( + [PSCustomObject]@{ + mentionUsers = [PSCustomObject]@{ + mentionees = $mentionees + replyTemplate = 'Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}.' + assignMentionees = 'False' + } + } + ) + }) + } + } + } +} + +# Update yaml file +InitializeRequiredPackages + +$yamlConfigPath = $PSScriptRoot | Split-Path | Split-Path | Join-Path -ChildPath ".github" | Join-Path -ChildPath "policies" | Join-Path -ChildPath "resourceManagement.yml" +$yamlContent = Get-Content -Path $yamlConfigPath -Raw +$yamlDeserializer = [YamlDotNet.Serialization.DeserializerBuilder]::new().Build() +$yamlObjectGraph = $yamlDeserializer.Deserialize($yamlContent) +$jsonSerializer = [YamlDotNet.Serialization.SerializerBuilder]::new().JsonCompatible().Build() +$jsonObjectGraph = $jsonSerializer.Serialize($yamlObjectGraph) | ConvertFrom-Json + +$serviceContactsTask = $jsonObjectGraph.configuration.resourceManagementConfiguration.eventResponderTasks | Where-Object { $_.description -eq "Triage issues to the service team" } +if ($null -ne $serviceContactsTask) { + $serviceContactsTask.then = $serviceContacts.Values +} + +$updatedJsonContent = $jsonObjectGraph | ConvertTo-Json -Depth 64 +$updatedJsonObjectGraph = [Newtonsoft.Json.JsonConvert]::DeserializeObject[System.Dynamic.ExpandoObject]($updatedJsonContent) +$yamlSerializer = [YamlDotNet.Serialization.SerializerBuilder]::new().Build() +$updatedYamlContent = $yamlSerializer.Serialize($updatedJsonObjectGraph) +$updatedYamlContent | Out-File -FilePath $yamlConfigPath -NoNewline -Force + +# Remove trailing space on each line +(Get-Content -Path $yamlConfigPath) | ForEach-Object { $_.TrimEnd() } | Set-Content -Path $yamlConfigPath