Skip to content

Commit 9d4efda

Browse files
authored
Merge pull request #22212 from wastoresh/mergestorage
[Do not Squash] Merge latest main to Storage preview branch
2 parents e1992f5 + 0cbbe96 commit 9d4efda

File tree

9,422 files changed

+1290987
-1083635
lines changed

Some content is hidden

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

9,422 files changed

+1290987
-1083635
lines changed

.azure-pipelines/code-oob.yml

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
parameters:
2+
- name: TargetBranch
3+
displayName: Branch this module will generated to
4+
type: string
5+
default: main
6+
- name: ServiceName
7+
displayName: Service to OOB release
8+
type: string
9+
default: Databricks
10+
- name: Preview
11+
displayName: Is preview version
12+
type: boolean
13+
default: false
14+
stages:
15+
- stage: OOBRelease
16+
displayName: OOBRelease
17+
jobs:
18+
- job: OOBRelease
19+
timeoutInMinutes: 180
20+
pool: pool-windows-2019
21+
steps:
22+
- task: DotNetCoreCLI@2
23+
displayName: Build
24+
inputs:
25+
command: custom
26+
custom: msbuild
27+
arguments: 'build.proj "/t:Clean;Build" /p:Configuration=Release'
28+
- pwsh: |
29+
.\tools\RunVersionController.ps1 -ModuleName "Az.${{ parameters.ServiceName }}”
30+
displayName: 'Bump up version'
31+
- task: AzurePowerShell@5
32+
inputs:
33+
azureSubscription: '$(AzureSubscription)'
34+
ScriptType: 'InlineScript'
35+
azurePowerShellVersion: 'LatestVersion'
36+
inline: |
37+
Set-AzContext -Tenant $(TenantId) -SubscriptionId $(SubscriptionId)
38+
$Token = Get-AzKeyVaultSecret -VaultName $(KeyVaultName) -Name $(KeyVaultAccount) -AsPlainText
39+
git config user.email "[email protected]"
40+
git config user.name "azure-powershell-bot"
41+
git checkout -b codeoob/${{ parameters.ServiceName }}
42+
git add -A
43+
if (${{ parameters.Preview }} -eq $true) {
44+
git reset -- ./tools/Tools.Common/SerializedCmdlets/Az.${{ parameters.ServiceName }}.json
45+
}
46+
git commit -m "Bump up version for ${{ parameters.ServiceName }}"
47+
git remote set-url origin https://azure-powershell-bot:[email protected]/Azure/azure-powershell.git;
48+
git push origin codeoob/${{ parameters.ServiceName }} --force;
49+
$Title = "Migrate ${{ parameters.ServiceName }} from oob to main"
50+
$HeadBranch = "codeoob/${{ parameters.ServiceName }}"
51+
$BaseBranch = "${{ parameters.TargetBranch }}"
52+
$Description = "Migrate ${{ parameters.ServiceName }} from oob to ${{parameters.TargetBranch}}"
53+
./tools/Github/CreatePR.ps1 -Title $Title -HeadBranch $HeadBranch -BaseBranch $BaseBranch -BotAccessToken $Token -Description $Description -Draft $true
54+
displayName: Create PR to main branch
55+
- task: PowerShell@2
56+
displayName: get changelog info
57+
inputs:
58+
targetType: 'inline'
59+
script: |
60+
$readme = Get-ChildItem -Path "./src/${{ parameters.ServiceName }}" -name ChangeLog.md -Recurse
61+
$mdContent = Get-Content -Path "src/${{ parameters.ServiceName }}/$readme" -Raw
62+
$pattern = '(?s)## Version (\d+\.\d+\.\d)+[\s\S]*?\n(.*?)(?=\n## Version \d+\.\d+\.\d+|$)'
63+
$matches = [regex]::Match($mdcontent, $pattern)
64+
if ($matches.Success) {
65+
$versionNumber = $matches.Groups[1].Value
66+
$versionChanges = $matches.Groups[2].Value.Trim()
67+
}
68+
$jsonData = @{
69+
ModuleName = "${{ parameters.ServiceName }}"
70+
VersionNumber = "$versionNumber"
71+
VersionChanges = "$versionChanges"
72+
IsPreview = “${{ parameters.Preview }}“
73+
}
74+
$jsonString = $jsonData | ConvertTo-Json
75+
$jsonString | Out-File -FilePath "VersionInfo.json"
76+
$folderPath = "OOB"
77+
$fileName = "VersionInfo.json"
78+
New-Item -ItemType Directory -Force -Path $folderPath | Out-Null
79+
$filePath = Join-Path -Path $folderPath -ChildPath $fileName
80+
$jsonString | Out-File -FilePath $filePath
81+
$content = @"
82+
The OOB build is ready. Please give it a test and let us know if it's OK to publish.
83+
84+
How to install:
85+
- Install the Az.Tools.Installer module.
86+
``````powershell
87+
Install-Module -Name Az.Tools.Installer -Repository PSGallery
88+
``````
89+
- Install the latest Az.Accounts module unless the OOB build requires a specific version.
90+
``````powershell
91+
Install-Module Az.Accounts -Repository PSGallery
92+
``````
93+
- Use Az.Tools.Installer to install the OOB build.
94+
``````powershell
95+
Install-AzModule -Path $(BlobUrl)/Az.${{ parameters.ServiceName }}.$versionNumber.nupkg
96+
``````
97+
98+
"@
99+
$readmePath = "OOB/README.md"
100+
$content | Out-File -FilePath $readmePath
101+
102+
- task: PowerShell@2
103+
displayName: publish oob tools
104+
inputs:
105+
targetType: 'inline'
106+
script: |
107+
Copy-Item .\tools\ModulePublisher.psd1 -Destination OOB
108+
Copy-Item .\tools\ModulePublisher.psm1 -Destination OOB
109+
Copy-Item .\tools\NuGet.exe -Destination OOB
110+
- task: PublishBuildArtifacts@1
111+
inputs:
112+
PathtoPublish: OOB
113+
ArtifactName: OOB
114+
- stage: Codesign
115+
dependsOn: OOBRelease
116+
jobs:
117+
- template: ./code-sign.yml
118+
parameters:
119+
OOBBranch: codeoob/${{ parameters.ServiceName }}
120+
- job: PulishForTest
121+
dependsOn: Release
122+
steps:
123+
- task: DownloadBuildArtifacts@1
124+
inputs:
125+
buildType: 'current'
126+
downloadType: 'single'
127+
artifactName: 'OOB'
128+
downloadPath: '$(System.ArtifactsDirectory)'
129+
- task: DownloadBuildArtifacts@1
130+
inputs:
131+
buildType: 'current'
132+
downloadType: 'single'
133+
artifactName: 'artifacts'
134+
downloadPath: '$(System.ArtifactsDirectory)'
135+
- task: AzurePowerShell@5
136+
displayName: 'Push packages to storage account'
137+
inputs:
138+
azureSubscription: '$(AzureSubscription)'
139+
ScriptType: InlineScript
140+
azurePowerShellVersion: LatestVersion
141+
pwsh: true
142+
Inline: |
143+
$jsonFilePath = "$(System.ArtifactsDirectory)/OOB/VersionInfo.json"
144+
$jsonContent = Get-Content -Path $jsonFilePath -Raw
145+
$jsonObject = $jsonContent | ConvertFrom-Json
146+
$versionNumber = $jsonObject.VersionNumber
147+
$versionChanges = $jsonObject.VersionChanges
148+
$moduleName = $jsonObject.ModuleName
149+
$context = New-AzStorageContext -StorageAccountName "$(TestStorageAccountName)"
150+
$package = Get-Item "$(System.ArtifactsDirectory)/artifacts/Az.$moduleName.$versionNumber.nupkg"
151+
$package | Set-AzStorageBlobContent -Container "public" -Context $context -Force
152+
153+
154+

0 commit comments

Comments
 (0)