-
Notifications
You must be signed in to change notification settings - Fork 3.4k
{Misc.} Added changes for internal team developer operations #32970
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b2f5c27
added changes for squad mapping
a0x1ab e5d6000
Merge branch 'Azure:dev' into dev
a0x1ab dc3413e
added changes per suggestion
a0x1ab 6658691
Merge branch 'dev' of https://github.com/a0x1ab/azure-cli into dev
a0x1ab 83a4013
Merge branch 'Azure:dev' into dev
a0x1ab c328cdd
updated parsing file
a0x1ab d8dda2e
Merge branch 'dev' of https://github.com/a0x1ab/azure-cli into dev
a0x1ab 62d4592
updated parse squad mapping list script
a0x1ab c007286
Merge branch 'Azure:dev' into dev
a0x1ab File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| name: Azure CLI Sync Squad Mapping | ||
|
|
||
| schedules: | ||
| - cron: "20 16 * * 0" | ||
| displayName: 12:20 AM (UTC + 8:00) China Weekly Run | ||
| branches: | ||
| include: | ||
| - dev | ||
|
|
||
| resources: | ||
| repositories: | ||
| - repository: SquadMappingWiki | ||
| type: git | ||
| name: internal.wiki | ||
|
|
||
| variables: | ||
| - template: ${{ variables.Pipeline.Workspace }}/.azure-pipelines/templates/variables.yml | ||
|
|
||
| jobs: | ||
| - job: UpdateYaml | ||
| displayName: Update resourceManagement.yml with squad labels | ||
| pool: | ||
| name: ${{ variables.windows_pool }} | ||
| uses: | ||
| repositories: | ||
| - SquadMappingWiki | ||
|
|
||
| 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 ./tools/Github/ParseSquadMappingList.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 wiki." | ||
| 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 | ||
| condition: and(succeeded(), eq(variables['ChangesDetected'], 'true')) | ||
|
|
||
| - pwsh: | | ||
| git config --global user.email "AzPyCLI@microsoft.com" | ||
| git config --global user.name "Azure CLI Team" | ||
| git checkout -b "sync_squad_mapping_$env:Build_BuildId" | ||
|
|
||
| git add .github/policies | ||
| git commit -m "Sync resourceManagement.yml for squad mapping" | ||
|
|
||
| git remote add azclibot https://azclibot:$(GithubToken)@github.com/azclibot/azure-cli.git | ||
| git push azclibot "sync_squad_mapping_$env:Build_BuildId" --force | ||
| displayName: Git commit and push | ||
| condition: and(succeeded(), eq(variables['ChangesDetected'], 'true')) | ||
|
|
||
| - pwsh: | | ||
| $Title = "{CI} Sync squad mapping labels from ADO Wiki to resourceManagement.yml" | ||
| $HeadBranch = "azclibot:sync_squad_mapping_$env:Build_BuildId" | ||
| $BaseBranch = "dev" | ||
| $Description = "This PR synchronizes squad labels in resourceManagement.yml based on the Squad Mapping 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/pulls" | ||
|
|
||
| Invoke-WebRequest -Uri $Uri -Method POST -Headers $Headers -Body ($RequestBody | ConvertTo-Json) | ||
| displayName: Create PR to azure/azure-cli dev branch | ||
| condition: and(succeeded(), eq(variables['ChangesDetected'], 'true')) | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.