Skip to content

Commit 3bcda6b

Browse files
authored
Initial check-in for the OneBranch release pipeline (#239)
1 parent d672195 commit 3bcda6b

13 files changed

+490
-34
lines changed

.pipelines/Build-Official.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,8 @@ variables:
1919
value: 1
2020
- name: POWERSHELL_TELEMETRY_OPTOUT
2121
value: 1
22-
- name: nugetMultiFeedWarnLevel
23-
value: none
24-
- name: NugetSecurityAnalysisWarningLevel
25-
value: none
26-
- name: skipNugetSecurityAnalysis
27-
value: true
22+
- name: DOTNET_NOLOGO
23+
value: 1
2824
- name: branchCounterKey
2925
value: $[format('{0:yyyyMMdd}-{1}', pipeline.startTime,variables['Build.SourceBranch'])]
3026
- name: branchCounter
@@ -68,7 +64,6 @@ extends:
6864
ignoreDirectories: 'docs,test,tools'
6965
asyncSdl:
7066
enabled: true
71-
forStages: [prep, macos, linux, windows]
7267
credscan:
7368
enabled: true
7469
scanFolder: $(Build.SourcesDirectory)

.pipelines/Package-Official.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,8 @@ variables:
2020
value: ${{ parameters.debug }}
2121
- name: ENABLE_PRS_DELAYSIGN
2222
value: 1
23-
- name: ROOT
24-
value: $(Build.SourcesDirectory)
2523
- name: ForceAzureBlobDelete
2624
value: ${{ parameters.ForceAzureBlobDelete }}
27-
- name: NUGET_XMLDOC_MODE
28-
value: none
29-
- name: nugetMultiFeedWarnLevel
30-
value: none
31-
- name: NugetSecurityAnalysisWarningLevel
32-
value: none
33-
- name: skipNugetSecurityAnalysis
34-
value: true
3525
- name: ob_outputDirectory
3626
value: '$(Build.ArtifactStagingDirectory)/ONEBRANCH_ARTIFACT'
3727
- name: WindowsContainerImage
@@ -52,8 +42,6 @@ resources:
5242
trigger:
5343
branches:
5444
include:
55-
- main
56-
- obp-*
5745
- release-*
5846

5947
repositories:
@@ -89,7 +77,6 @@ extends:
8977
ignoreDirectories: 'docs,shell,test,tools'
9078
asyncSdl:
9179
enabled: true
92-
forStages: ['build']
9380
credscan:
9481
enabled: true
9582
scanFolder: $(Build.SourcesDirectory)

.pipelines/Release-Official.yml

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
trigger: none
2+
3+
parameters: # parameters are shown up in ADO UI in a build queue time
4+
- name: 'debug'
5+
displayName: 'Enable debug output'
6+
type: boolean
7+
default: false
8+
9+
variables:
10+
- name: CDP_DEFINITION_BUILD_COUNT
11+
value: $[counter('', 0)]
12+
- name: system.debug
13+
value: ${{ parameters.debug }}
14+
- name: ob_outputDirectory
15+
value: '$(Build.ArtifactStagingDirectory)/ONEBRANCH_ARTIFACT'
16+
- name: WindowsContainerImage
17+
value: 'onebranch.azurecr.io/windows/ltsc2022/vse2022:latest'
18+
- name: LinuxContainerImage
19+
value: mcr.microsoft.com/onebranch/cbl-mariner/build:2.0
20+
21+
resources:
22+
repositories:
23+
- repository: templates
24+
type: git
25+
name: OneBranch.Pipelines/GovernedTemplates
26+
ref: refs/heads/main
27+
28+
pipelines:
29+
- pipeline: AIShellPackagePipeline
30+
source: 'AIShell-Package-Official'
31+
trigger:
32+
branches:
33+
include:
34+
- release-*
35+
36+
extends:
37+
template: v2/OneBranch.Official.CrossPlat.yml@templates
38+
parameters:
39+
cloudvault:
40+
enabled: false
41+
featureFlags:
42+
LinuxHostVersion:
43+
Network: KS3
44+
WindowsHostVersion:
45+
Version: 2022
46+
# Azure container/blob operations get blocked when using KS3
47+
Network: KS2
48+
globalSdl:
49+
asyncSdl:
50+
enabled: true
51+
tsaOptionsFile: .config\tsaoptions.json
52+
53+
stages:
54+
- stage: msixbundle
55+
displayName: 'Create MSIX Bundle'
56+
jobs:
57+
- template: /.pipelines/templates/release-msix-bundle.yml@self
58+
59+
- stage: ManualValidation
60+
dependsOn: []
61+
displayName: Manual Validation
62+
jobs:
63+
- template: /.pipelines/templates/wait-for-approval.yml@self
64+
parameters:
65+
displayName: Validate Windows Packages
66+
jobName: ValidateWinPkg
67+
instructions: |
68+
Validate zip package on Windows
69+
- template: /.pipelines/templates/wait-for-approval.yml@self
70+
parameters:
71+
displayName: Validate OSX Packages
72+
jobName: ValidateOsxPkg
73+
instructions: |
74+
Validate tar.gz package on macOS
75+
- template: /.pipelines/templates/wait-for-approval.yml@self
76+
parameters:
77+
displayName: Validate Linux Packages
78+
jobName: ValidateLinuxPkg
79+
instructions: |
80+
Validate tar.gz package on Linux
81+
- template: /.pipelines/templates/wait-for-approval.yml@self
82+
parameters:
83+
displayName: Validate AIShell module
84+
jobName: ValidateModule
85+
instructions: |
86+
Validate AIShell module
87+
- template: /.pipelines/templates/wait-for-approval.yml@self
88+
parameters:
89+
displayName: Validate NuGet SDK
90+
jobName: ValidateSDK
91+
instructions: |
92+
Validate NuGet SDK package
93+
94+
- stage: UpdateChangeLog
95+
displayName: Update the changelog
96+
dependsOn:
97+
- ManualValidation
98+
- msixbundle
99+
jobs:
100+
- template: /.pipelines/templates/wait-for-approval.yml@self
101+
parameters:
102+
displayName: Make sure the changelog is updated
103+
jobName: MergeChangeLog
104+
instructions: |
105+
Update and merge the changelog for the release.
106+
This step is required for creating GitHub draft release.
107+
108+
- stage: PublishGitHubRelease
109+
displayName: Publish GitHub Release
110+
dependsOn: BlobPublic
111+
jobs:
112+
- template: /.pipelines/templates/release-publish-github.yml@self
113+
114+
- stage: PublishNuGet
115+
displayName: Publish NuGet
116+
dependsOn: PublishGitHubRelease
117+
jobs:
118+
- template: /.pipelines/templates/release-publish-nuget.yml@self
119+
parameters:
120+
publish: false
121+
122+
- stage: PublishModule
123+
displayName: Publish Module
124+
dependsOn: PublishGitHubRelease
125+
jobs:
126+
- template: /.pipelines/templates/release-publish-module.yml@self
127+
parameters:
128+
publish: false
129+
130+
- stage: PublishMsix
131+
dependsOn: PublishGitHubRelease
132+
displayName: Publish MSIX to store
133+
jobs:
134+
- template: /.pipelines/templates/wait-for-approval.yml@self
135+
parameters:
136+
displayName: Publish the MSIX Bundle package to store
137+
jobName: PublishMsix
138+
instructions: |
139+
Ask Steve to release MSIX bundle package to Store
140+
141+
- stage: ReleaseDone
142+
displayName: Finish Release
143+
dependsOn: ['PublishMsix', 'PublishModule', 'PublishNuGet']
144+
jobs:
145+
- template: /.pipelines/templates/wait-for-approval.yml@self
146+
parameters:
147+
displayName: Retain Build
148+
jobName: RetainBuild
149+
instructions: |
150+
Retain the build
151+
- template: /.pipelines/templates/wait-for-approval.yml@self
152+
parameters:
153+
displayName: Delete release branch
154+
jobName: DeleteBranch
155+
instructions: |
156+
Delete release

.pipelines/templates/linux-build.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ jobs:
1212
value: false
1313
- name: NugetSecurityAnalysisWarningLevel
1414
value: none
15-
- name: DOTNET_NOLOGO
16-
value: 1
1715
- group: DotNetPrivateBuildAccess
1816
- name: ob_outputDirectory
1917
value: '$(Build.ArtifactStagingDirectory)/ONEBRANCH_ARTIFACT'
@@ -113,8 +111,6 @@ jobs:
113111
value: false
114112
- name: NugetSecurityAnalysisWarningLevel
115113
value: none
116-
- name: DOTNET_NOLOGO
117-
value: 1
118114
- group: DotNetPrivateBuildAccess
119115
- group: certificate_logical_to_actual
120116
- name: ob_outputDirectory

.pipelines/templates/mac-build.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ jobs:
1414
variables:
1515
- name: HOMEBREW_NO_ANALYTICS
1616
value: 1
17-
- name: DOTNET_NOLOGO
18-
value: 1
1917
- name: runCodesignValidationInjection
2018
value: false
2119
- name: NugetSecurityAnalysisWarningLevel
@@ -78,8 +76,6 @@ jobs:
7876
variables:
7977
- name: NugetSecurityAnalysisWarningLevel
8078
value: none
81-
- name: DOTNET_NOLOGO
82-
value: 1
8379
- group: DotNetPrivateBuildAccess
8480
- group: certificate_logical_to_actual
8581
- name: ob_outputDirectory

.pipelines/templates/module-build.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ jobs:
99
value: false
1010
- name: NugetSecurityAnalysisWarningLevel
1111
value: none
12-
- name: DOTNET_NOLOGO
13-
value: 1
1412
- group: DotNetPrivateBuildAccess
1513
- name: ob_outputDirectory
1614
value: '$(Build.ArtifactStagingDirectory)/ONEBRANCH_ARTIFACT'
@@ -106,8 +104,6 @@ jobs:
106104
value: false
107105
- name: NugetSecurityAnalysisWarningLevel
108106
value: none
109-
- name: DOTNET_NOLOGO
110-
value: 1
111107
- group: DotNetPrivateBuildAccess
112108
- group: certificate_logical_to_actual
113109
- name: ob_outputDirectory

.pipelines/templates/module-package.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ jobs:
5757
$moduleFolder = "$(Pipeline.Workspace)/AIShellBuildPipeline/AIShell"
5858
$null = New-Item -ItemType Directory -Path $moduleFolder -Force
5959
60+
Write-Verbose -Verbose "Delete SBOM files ..."
61+
Remove-Item -Path "$signedFilePath/_manifest" -Recurse -Force
62+
6063
Write-Verbose -Verbose "Move module files to the 'AIShell' module folder: "
6164
Copy-Item -Path "$signedFilePath/*" -Destination $moduleFolder -Recurse -Force -Verbose
6265
Get-ChildItem $moduleFolder -Recurse | Out-String -Width 500 -Stream
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
jobs:
2+
- job: CreateMSIXBundle
3+
displayName: Create .msixbundle file
4+
pool:
5+
type: windows
6+
7+
variables:
8+
- group: msixTools
9+
- group: 'Azure Blob variable group'
10+
- name: ob_outputDirectory
11+
value: '$(Build.ArtifactStagingDirectory)/ONEBRANCH_ARTIFACT'
12+
13+
steps:
14+
- download: AIShellPackagePipeline
15+
artifact: drop_windows_package_arm64
16+
displayName: Download arm64 msix
17+
patterns: '**/*.msix'
18+
19+
- download: AIShellPackagePipeline
20+
artifact: drop_windows_package_x64
21+
displayName: Download x64 msix
22+
patterns: '**/*.msix'
23+
24+
- download: AIShellPackagePipeline
25+
artifact: drop_windows_package_x86
26+
displayName: Download x86 msix
27+
patterns: '**/*.msix'
28+
29+
- pwsh: |
30+
$cmd = Get-Command makeappx.exe -ErrorAction Ignore
31+
if ($cmd) {
32+
Write-Verbose -Verbose 'makeappx available in PATH'
33+
$exePath = $cmd.Source
34+
} else {
35+
$toolsDir = '$(Pipeline.Workspace)\releasePipeline\tools'
36+
New-Item $toolsDir -Type Directory -Force > $null
37+
Invoke-RestMethod -Uri '$(makeappUrl)' -OutFile "$toolsDir\makeappx.zip"
38+
Expand-Archive "$toolsDir\makeappx.zip" -DestinationPath "$toolsDir\makeappx" -Force
39+
$exePath = "$toolsDir\makeappx\makeappx.exe"
40+
41+
Write-Verbose -Verbose 'makeappx was installed:'
42+
Get-ChildItem -Path $toolsDir -Recurse
43+
}
44+
45+
$vstsCommandString = "vso[task.setvariable variable=MakeAppxPath]$exePath"
46+
Write-Host "sending " + $vstsCommandString
47+
Write-Host "##$vstsCommandString"
48+
displayName: Install makeappx tool
49+
retryCountOnTaskFailure: 1
50+
51+
- pwsh: |
52+
$sourceDir = '$(Pipeline.Workspace)\releasePipeline\msix'
53+
$null = New-Item -Path $sourceDir -ItemType Directory -Force
54+
55+
$msixFiles = Get-ChildItem -Path "$(Pipeline.Workspace)\AIShellPackagePipeline\*.msix" -Recurse
56+
foreach ($msixFile in $msixFiles) {
57+
$null = Copy-Item -Path $msixFile.FullName -Destination $sourceDir -Force -Verbose
58+
}
59+
60+
$file = Get-ChildItem $sourceDir | Select-Object -First 1
61+
$prefix = ($file.BaseName -split "-win")[0]
62+
$pkgName = "$prefix.msixbundle"
63+
Write-Verbose -Verbose "Creating $pkgName"
64+
65+
$makeappx = '$(MakeAppxPath)'
66+
$outputDir = "$sourceDir\output"
67+
New-Item $outputDir -Type Directory -Force > $null
68+
& $makeappx bundle /d $sourceDir /p "$outputDir\$pkgName"
69+
70+
Get-ChildItem -Path $sourceDir -Recurse | Out-String -Width 500 -Stream
71+
72+
$vstsCommandString = "vso[task.setvariable variable=BundleDir]$outputDir"
73+
Write-Host "sending " + $vstsCommandString
74+
Write-Host "##$vstsCommandString"
75+
displayName: Create MsixBundle
76+
retryCountOnTaskFailure: 1
77+
78+
- pwsh: |
79+
$azureRmModule = Get-InstalledModule AzureRM -ErrorAction SilentlyContinue -Verbose
80+
if ($azureRmModule) {
81+
Write-Host 'AzureRM module exists. Removing it'
82+
Uninstall-AzureRm
83+
Write-Host 'AzureRM module removed'
84+
}
85+
86+
Install-Module -Name Az.Storage -Force -AllowClobber -Scope CurrentUser -Verbose
87+
displayName: Remove AzRM modules and install Az.Storage
88+
89+
- task: AzurePowerShell@5
90+
displayName: Upload msix to blob
91+
inputs:
92+
azureSubscription: az-blob-cicd-infra
93+
scriptType: inlineScript
94+
azurePowerShellVersion: LatestVersion
95+
pwsh: true
96+
inline: |
97+
$containerName = 'aish'
98+
$storageAccount = '$(PSInfraStorageAccount)'
99+
100+
$storageContext = New-AzStorageContext -StorageAccountName $storageAccount -UseConnectedAccount
101+
102+
if ($env:BundleDir) {
103+
$bundleFile = (Get-Item "$env:BundleDir\*.msixbundle").FullName
104+
$fileName = $bundleFile | Split-Path -Leaf
105+
106+
$version = [System.IO.Path]::GetFileNameWithoutExtension($fileName).Replace('AIShell-', '')
107+
$blobName = "$version/$fileName"
108+
109+
Write-Verbose -Verbose "Uploading $bundleFile to $containerName/$blobName"
110+
$null = Set-AzStorageBlobContent -File $bundleFile -Container $containerName -Blob $blobName -Context $storageContext
111+
}
112+
else{
113+
throw "BundleDir not found"
114+
}

0 commit comments

Comments
 (0)