Skip to content

Commit 5d5fa5d

Browse files
author
Shikha Jha
committed
Merge branch 'dev' of https://github.com/Shi1810/azure-cli into user/shikhajha/errorcontext
2 parents 7667348 + 692b407 commit 5d5fa5d

866 files changed

Lines changed: 156811 additions & 83075 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
# Azure CLI - macOS Release Pipeline (Build → Sign → Test → Publish)
2+
#
3+
# Purpose: Complete end-to-end macOS release pipeline
4+
# Architecture: Chains 4 job templates in sequence
5+
#
6+
# Pipeline Flow:
7+
# 1. macos-build-jobs.yml → Build unsigned tarballs (ARM64 + Intel)
8+
# 2. macos-sign-notarize-jobs.yml → Sign and notarize via ESRP
9+
# 3. macos-test-jobs.yml → Test cask (local file://) + offline install
10+
# 4. macos-publish-jobs.yml → GitHub release + Homebrew cask update
11+
#
12+
# Output Artifacts:
13+
# - cli-build-unsigned-arm64, cli-build-unsigned-x86_64 (intermediate)
14+
# - cli-signed-notarized-arm64, cli-signed-notarized-x86_64 (final)
15+
16+
trigger: none
17+
18+
parameters:
19+
# Build parameters
20+
- name: PythonVersion
21+
displayName: 'Python Version (Homebrew)'
22+
type: string
23+
default: '3.13'
24+
25+
# Sign/notarize parameters
26+
- name: BundleId
27+
displayName: 'Bundle ID for notarization'
28+
type: string
29+
default: 'com.microsoft.azure.cli'
30+
31+
# Publish parameters
32+
- name: PublishToGitHub
33+
displayName: 'Publish to GitHub Release'
34+
type: boolean
35+
default: true
36+
37+
- name: GitHubRepo
38+
displayName: 'GitHub Repository (owner/repo)'
39+
type: string
40+
default: 'Azure/homebrew-azure-cli'
41+
42+
- name: UpdateHomebrew
43+
displayName: 'Update Homebrew cask after release'
44+
type: boolean
45+
default: true
46+
47+
- name: HomebrewTapRepo
48+
displayName: 'Homebrew Tap Repository'
49+
type: string
50+
default: 'Azure/homebrew-azure-cli'
51+
52+
- name: GitHubServiceConnection
53+
displayName: 'GitHub Service Connection'
54+
type: string
55+
default: 'Azure'
56+
57+
- name: ESRPServiceConnection
58+
displayName: 'ESRP Service Connection'
59+
type: string
60+
default: 'ame_esrp_connection'
61+
62+
- name: Debug
63+
displayName: 'Enable debug diagnostics'
64+
type: boolean
65+
default: false
66+
67+
resources:
68+
repositories:
69+
- repository: homebrewtap
70+
type: github
71+
endpoint: 'Azure'
72+
name: Azure/homebrew-azure-cli
73+
ref: main
74+
75+
variables:
76+
- template: templates/variables.yml
77+
- ${{ if eq(variables['System.TeamProject'], 'release') }}:
78+
- group: 'AME ESRP Variable Group'
79+
80+
- name: GitHubRepo
81+
value: ${{ parameters.GitHubRepo }}
82+
- name: HomebrewTapRepo
83+
value: ${{ parameters.HomebrewTapRepo }}
84+
85+
# Disable auto-injection tasks
86+
- name: Codeql.Enabled
87+
value: false
88+
- name: Codeql.SkipTaskAutoInjection
89+
value: true
90+
- name: CodeQL.enabled
91+
value: false
92+
- name: runCodesignValidationInjection
93+
value: false
94+
- name: DOTNET_CLI_TELEMETRY_OPTOUT
95+
value: 1
96+
- name: DOTNET_NOLOGO
97+
value: 1
98+
- name: NugetSecurityAnalysisWarningLevel
99+
value: none
100+
- name: skipNugetSecurityAnalysis
101+
value: true
102+
103+
name: macos-release-$(Build.BuildId)
104+
105+
# ============================================================================
106+
# JOBS: End-to-end macOS release flow
107+
# ============================================================================
108+
jobs:
109+
# ============================================================================
110+
# PHASE 1: BUILD (unsigned tarballs)
111+
# ============================================================================
112+
- template: templates/macos/macos-build-jobs.yml
113+
parameters:
114+
PythonVersion: ${{ parameters.PythonVersion }}
115+
MacosArm64Image: ${{ variables.macos_arm64_pool }}
116+
MacosIntelImage: ${{ variables.macos_intel_pool }}
117+
118+
# Jobs included:
119+
# - BuildMacOSCli (matrix: ARM64 + Intel)
120+
# - VerifyMacOSCli (matrix: ARM64 + Intel)
121+
# Artifacts: cli-build-unsigned-arm64, cli-build-unsigned-x86_64
122+
123+
# ============================================================================
124+
# PHASE 2: SIGN & NOTARIZE (via ESRP)
125+
# ============================================================================
126+
- ${{ if eq(variables['System.TeamProject'], 'release') }}:
127+
- template: templates/macos/macos-sign-notarize-jobs.yml
128+
parameters:
129+
BundleId: ${{ parameters.BundleId }}
130+
PythonVersion: ${{ parameters.PythonVersion }}
131+
MacosArm64Image: ${{ variables.macos_arm64_pool }}
132+
MacosIntelImage: ${{ variables.macos_intel_pool }}
133+
ESRPServiceConnection: ${{ parameters.ESRPServiceConnection }}
134+
UseCurrentPipelineArtifacts: true
135+
dependsOn:
136+
- VerifyMacOSCli
137+
138+
# Jobs included:
139+
# - DownloadAnalyze (matrix: ARM64 + Intel)
140+
# - SignBinaries (matrix: ARM64 + Intel)
141+
# - CreateNotarizeBundle (matrix: ARM64 + Intel)
142+
# - Notarize (matrix: ARM64 + Intel)
143+
# - CreateFinalTarball (matrix: ARM64 + Intel)
144+
# Artifacts: cli-signed-notarized-arm64, cli-signed-notarized-x86_64
145+
146+
# ============================================================================
147+
# PHASE 3a: TEST (local file:// cask + offline install)
148+
# ============================================================================
149+
- ${{ if eq(variables['System.TeamProject'], 'release') }}:
150+
- template: templates/macos/macos-cask-generation-and-tests.yml
151+
parameters:
152+
MacosArm64Image: ${{ variables.macos_arm64_pool }}
153+
MacosIntelImage: ${{ variables.macos_intel_pool }}
154+
PythonVersion: ${{ parameters.PythonVersion }}
155+
GitHubRepo: $(GitHubRepo)
156+
Debug: ${{ parameters.Debug }}
157+
dependsOn:
158+
- CreateFinalTarball
159+
160+
# Jobs included:
161+
# - TestTempTapCask (matrix: ARM64 + Intel) - tests cask with local file:// URLs
162+
# - TestOfflineInstall (matrix: ARM64 + Intel) - tests direct tarball install
163+
164+
# ============================================================================
165+
# PHASE 3b: PUBLISH (GitHub + Homebrew tap)
166+
# ============================================================================
167+
- ${{ if eq(variables['System.TeamProject'], 'release') }}:
168+
- template: templates/macos/macos-publish-jobs.yml
169+
parameters:
170+
PublishToGitHub: ${{ parameters.PublishToGitHub }}
171+
UpdateHomebrew: ${{ parameters.UpdateHomebrew }}
172+
TestAfterPublish: false
173+
GitHubRepo: $(GitHubRepo)
174+
GitHubServiceConnection: ${{ parameters.GitHubServiceConnection }}
175+
HomebrewTapRepo: ${{ parameters.HomebrewTapRepo }}
176+
MacosArm64Image: ${{ variables.macos_arm64_pool }}
177+
MacosIntelImage: ${{ variables.macos_intel_pool }}
178+
PythonVersion: ${{ parameters.PythonVersion }}
179+
Debug: ${{ parameters.Debug }}
180+
dependsOn:
181+
- TestTempTapCask
182+
- TestOfflineInstall
183+
184+
# Jobs included:
185+
# - CreateGitHubRelease (conditional)
186+
# - UpdateHomebrewCask (conditional)
187+
# - PrintSummary
188+
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Azure CLI Sync Squad Mapping
2+
3+
schedules:
4+
- cron: "20 16 * * 0"
5+
displayName: 12:20 AM (UTC + 8:00) China Weekly Run
6+
branches:
7+
include:
8+
- dev
9+
10+
resources:
11+
repositories:
12+
- repository: SquadMappingWiki
13+
type: git
14+
name: internal.wiki
15+
16+
variables:
17+
- template: ${{ variables.Pipeline.Workspace }}/.azure-pipelines/templates/variables.yml
18+
19+
jobs:
20+
- job: UpdateYaml
21+
displayName: Update resourceManagement.yml with squad labels
22+
pool:
23+
name: ${{ variables.windows_pool }}
24+
uses:
25+
repositories:
26+
- SquadMappingWiki
27+
28+
steps:
29+
- task: UseDotNet@2
30+
displayName: Install .NET 8 SDK
31+
inputs:
32+
packageType: sdk
33+
version: 8.0.x
34+
35+
- pwsh: |
36+
dotnet --version
37+
dotnet new tool-manifest --force
38+
dotnet tool install powershell --version 7.4.*
39+
displayName: Install PowerShell 7.4.x
40+
41+
- pwsh: |
42+
dotnet tool run pwsh -NoLogo -NoProfile -NonInteractive -File ./tools/Github/ParseSquadMappingList.ps1 -AccessToken $env:SYSTEM_ACCESSTOKEN
43+
env:
44+
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
45+
displayName: Update resourceManagement.yml file locally
46+
47+
- pwsh: |
48+
$hasChanges = git diff --name-only .github/policies
49+
if ($null -eq $hasChanges) {
50+
Write-Host "The wiki has no changes."
51+
Write-Host "##vso[task.setvariable variable=ChangesDetected]false"
52+
} else {
53+
Write-Host "There are changes in the wiki."
54+
Write-Host "##vso[task.setvariable variable=ChangesDetected]true"
55+
}
56+
displayName: Check if Wiki table has any changes
57+
58+
- task: AzurePowerShell@5
59+
inputs:
60+
pwsh: true
61+
azureSubscription: '$(AZURE_SDK_INFRA_SUB_CONNECTED_SERVICE)'
62+
ScriptType: 'InlineScript'
63+
Inline: |
64+
$GithubToken = Get-AzKeyVaultSecret -VaultName $(GithubPATKeyVaultName) -Name $(GithubPATKeyVaultAccount) -AsPlainText
65+
Write-Host "##vso[task.setvariable variable=GithubToken;issecret=true]$GithubToken"
66+
azurePowerShellVersion: 'LatestVersion'
67+
displayName: Get Github PAT from Key Vault
68+
condition: and(succeeded(), eq(variables['ChangesDetected'], 'true'))
69+
70+
- pwsh: |
71+
git config --global user.email "AzPyCLI@microsoft.com"
72+
git config --global user.name "Azure CLI Team"
73+
git checkout -b "sync_squad_mapping_$env:Build_BuildId"
74+
75+
git add .github/policies
76+
git commit -m "Sync resourceManagement.yml for squad mapping"
77+
78+
git remote add azclibot https://azclibot:$(GithubToken)@github.com/azclibot/azure-cli.git
79+
git push azclibot "sync_squad_mapping_$env:Build_BuildId" --force
80+
displayName: Git commit and push
81+
condition: and(succeeded(), eq(variables['ChangesDetected'], 'true'))
82+
83+
- pwsh: |
84+
$Title = "{CI} Sync squad mapping labels from ADO Wiki to resourceManagement.yml"
85+
$HeadBranch = "azclibot:sync_squad_mapping_$env:Build_BuildId"
86+
$BaseBranch = "dev"
87+
$Description = "This PR synchronizes squad labels in resourceManagement.yml based on the Squad Mapping ADO wiki page."
88+
89+
$Headers = @{"Accept" = "application/vnd.github+json"; "Authorization" = "Bearer $(GithubToken)" }
90+
$RequestBody = @{"title" = $Title; "body" = $Description; "head" = $HeadBranch; "base" = $BaseBranch;}
91+
$Uri = "https://api.github.com/repos/Azure/azure-cli/pulls"
92+
93+
Invoke-WebRequest -Uri $Uri -Method POST -Headers $Headers -Body ($RequestBody | ConvertTo-Json)
94+
displayName: Create PR to azure/azure-cli dev branch
95+
condition: and(succeeded(), eq(variables['ChangesDetected'], 'true'))

0 commit comments

Comments
 (0)