Skip to content

Commit 11cdf68

Browse files
add null check for empty kube-config in connectedk8s proxy scenario
add null check for empty kube-config in connectedk8s proxy scenario
2 parents 1900b56 + 5d5a5af commit 11cdf68

File tree

165 files changed

+69820
-11697
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+69820
-11697
lines changed

.azure-pipelines/sync-alias.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Azure CLI Sync Alias
2+
3+
schedules:
4+
- cron: "50 15 * * 0"
5+
displayName: 11:50 PM (UTC + 8:00) China Weekly Run
6+
branches:
7+
include:
8+
- main
9+
10+
# The 'resources' and 'uses' below are used to resolve the error 'Repository associated with wiki ID <WikiId> does not exist or you do not have permissions for the operation you are attempting.'
11+
resources:
12+
repositories:
13+
- repository: ServiceContactList
14+
type: git
15+
name: internal.wiki
16+
17+
jobs:
18+
- job: UpdateYaml
19+
displayName: Update resourceManagement.yml
20+
pool: pool-windows-2019
21+
uses:
22+
repositories:
23+
- ServiceContactList
24+
25+
steps:
26+
- task: UseDotNet@2
27+
displayName: Install .NET 8 SDK
28+
inputs:
29+
packageType: sdk
30+
version: 8.0.x
31+
32+
- pwsh: |
33+
dotnet --version
34+
dotnet new tool-manifest --force
35+
dotnet tool install powershell --version 7.4.*
36+
displayName: Install PowerShell 7.4.x
37+
38+
- pwsh: |
39+
dotnet tool run pwsh -NoLogo -NoProfile -NonInteractive -File ./scripts/automation/ParseServiceContactsList.ps1 -AccessToken $env:SYSTEM_ACCESSTOKEN
40+
env:
41+
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
42+
displayName: Update resourceManagement.yml file locally
43+
44+
- pwsh: |
45+
$hasChanges = git diff --name-only .github/policies
46+
if ($null -eq $hasChanges) {
47+
Write-Host "The wiki has no changes."
48+
Write-Host "##vso[task.setvariable variable=ChangesDetected]false"
49+
} else {
50+
Write-Host "There are changes in the repository."
51+
Write-Host "##vso[task.setvariable variable=ChangesDetected]true"
52+
}
53+
displayName: Check if Wiki table has any changes
54+
55+
- task: AzurePowerShell@5
56+
inputs:
57+
pwsh: true
58+
azureSubscription: '$(AZURE_SDK_INFRA_SUB_CONNECTED_SERVICE)'
59+
ScriptType: 'InlineScript'
60+
Inline: |
61+
$GithubToken = Get-AzKeyVaultSecret -VaultName $(GithubPATKeyVaultName) -Name $(GithubPATKeyVaultAccount) -AsPlainText
62+
Write-Host "##vso[task.setvariable variable=GithubToken;issecret=true]$GithubToken"
63+
azurePowerShellVersion: 'LatestVersion'
64+
displayName: Get Github PAT from Key Vault
65+
66+
- pwsh: |
67+
git config --global user.email "AzPyCLI@microsoft.com"
68+
git config --global user.name "Azure CLI Team"
69+
git checkout -b "sync_alias_$env:Build_BuildId"
70+
71+
git add .github/policies
72+
git commit -m "Sync resourceManagement.yml"
73+
74+
git remote set-url origin https://azclibot:$(GithubToken)@github.com/Azure/azure-cli-extensions.git;
75+
git push origin "sync_alias_$env:Build_BuildId" --force
76+
displayName: Git commit and push
77+
condition: and(succeeded(), eq(variables['ChangesDetected'], 'true'))
78+
79+
- pwsh: |
80+
$Title = "{CI} Sync resourceManagement.yml according To ADO Wiki Page - Service Contact List"
81+
$HeadBranch = "sync_alias_$env:Build_BuildId"
82+
$BaseBranch = "main"
83+
$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"
84+
85+
$Headers = @{"Accept" = "application/vnd.github+json"; "Authorization" = "Bearer $(GithubToken)" }
86+
$RequestBody = @{"title" = $Title; "body" = $Description; "head" = $HeadBranch; "base" = $BaseBranch;}
87+
$Uri = "https://api.github.com/repos/Azure/azure-cli-extensions/pulls"
88+
89+
Invoke-WebRequest -Uri $Uri -Method POST -Headers $Headers -Body ($RequestBody | ConvertTo-Json)
90+
91+
displayName: Create PR to main branch
92+
condition: and(succeeded(), eq(variables['ChangesDetected'], 'true'))

0 commit comments

Comments
 (0)