Skip to content

Commit 1e6437a

Browse files
committed
split windows part into template
1 parent 3f76596 commit 1e6437a

File tree

2 files changed

+112
-258
lines changed

2 files changed

+112
-258
lines changed

.pipelines/DSC-Official.yml

Lines changed: 6 additions & 258 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ schedules:
1818
variables:
1919
BuildConfiguration: 'release'
2020
PackageRoot: '$(System.ArtifactsDirectory)/Packages'
21-
# LinuxContainerImage: 'mcr.microsoft.com/onebranch/cbl-mariner/build:2.0'
2221
WindowsContainerImage: 'onebranch.azurecr.io/windows/ltsc2022/vse2022:latest'
2322
Codeql.TSAEnabled: true
2423

@@ -87,212 +86,17 @@ extends:
8786
8887
- job: BuildWin_x64
8988
dependsOn: SetPackageVersion
90-
variables:
91-
buildName: x86_64-pc-windows-msvc
92-
PackageVersion: $[ dependencies.SetPackageVersion.outputs['Package.Version'] ]
93-
ob_sdl_tsa_configFile: '$(Build.SourcesDirectory)\DSC\.config\tsaoptions.json'
94-
ob_outputDirectory: '$(Build.ArtifactStagingDirectory)'
95-
repoRoot: '$(Build.SourcesDirectory)\DSC'
96-
signSrcPath: '$(Build.SourcesDirectory)\out'
97-
ob_sdl_sbom_enabled: true
98-
ob_signing_setup_enabled: true
99-
ob_sdl_codeql_compiled_enabled: true
100-
pool:
101-
type: windows
102-
displayName: BuildWin_x64
10389
steps:
104-
- checkout: self
105-
env:
106-
ob_restore_phase: true
107-
- task: CodeQL3000Init@0 # Add CodeQL Init task right before your 'Build' step.
108-
inputs:
109-
Enabled: true
110-
AnalyzeInPipeline: true
111-
Language: rust
112-
env:
113-
ob_restore_phase: true
114-
- pwsh: |
115-
$tmpdir = "$(Agent.TempDirectory)"
116-
Write-Host "##vso[task.setvariable variable=CARGO_TARGET_DIR;]$tmpdir"
117-
displayName: 🛠️ Workaround for the LoadLibrary ACCESS_VIOLATION OneBranch issue
118-
env:
119-
ob_restore_phase: true
120-
- task: RustInstaller@1
121-
inputs:
122-
rustVersion: ms-stable
123-
toolchainFeed: https://pkgs.dev.azure.com/mscodehub/Rust/_packaging/Rust/nuget/v3/index.json
124-
additionalTargets: $(buildName)
125-
displayName: Install Rust
126-
env:
127-
ob_restore_phase: true
128-
- pwsh: |
129-
Set-Location "$(Build.SourcesDirectory)/DSC"
130-
$LLVMBIN = "$($env:PROGRAMFILES)\Microsoft Visual Studio\2022\Enterprise\VC\Tools\Llvm\bin"
131-
if (!(Test-Path $LLVMBIN)) {
132-
throw "LLVM path '$LLVMBIN' does not exist"
133-
}
134-
$env:PATH += ";$LLVMBIN"
135-
write-verbose -verbose (gcm clang.exe | out-string)
136-
./build.ps1 -Release -Architecture $(buildName) -SkipLinkCheck
137-
displayName: 'Build $(buildName)'
138-
env:
139-
ob_restore_phase: true
140-
condition: succeeded()
141-
- task: CodeQL3000Finalize@0 # Add CodeQL Finalize task right after your 'Build' step.
142-
condition: always()
143-
env:
144-
ob_restore_phase: true
145-
- pwsh: |
146-
$null = New-Item -ItemType Directory -Path "$(PackageRoot)" -ErrorAction Ignore
147-
$null = New-Item -ItemType Directory -Path "$(PackageRoot)/out" -ErrorAction Ignore
148-
$null = New-Item -ItemType Directory -Path "$(signSrcPath)" -ErrorAction Ignore
149-
# workaround known issue of building in OneBranch copying from TMP folder
150-
$null = New-Item -ItemType Directory -Path "$(signSrcPath)" -ErrorAction Ignore
151-
# copy only the exes from the TMP folder since it contains intermediately built files we don't want to sign
152-
write-host 'Binaries in $(env:CARGO_TARGET_DIR)'
153-
Copy-Item -Path "$env:CARGO_TARGET_DIR/$(buildName)/$(BuildConfiguration)/*.exe" -Destination "$(signSrcPath)" -Verbose
154-
Copy-Item -Path "$(Build.SourcesDirectory)/DSC/bin/$(buildName)/$(BuildConfiguration)/*" -Recurse -Destination "$(signSrcPath)" -Verbose -Force
155-
write-host 'Binaries in $(signSrcPath)'
156-
dir -r "$(signSrcPath)"
157-
displayName: Copy built binaries
158-
env:
159-
ob_restore_phase: true
160-
condition: succeeded()
161-
- task: onebranch.pipeline.signing@1
162-
displayName: Sign 1st party files
163-
inputs:
164-
command: 'sign'
165-
signing_profile: external_distribution
166-
files_to_sign: |
167-
**\*.exe;
168-
**\*.ps1;
169-
**\*.psd1;
170-
**\*.psm1;
171-
search_root: $(signSrcPath)
172-
- task: CopyFiles@2
173-
displayName: "Copy signed files to build target dir"
174-
inputs:
175-
SourceFolder: "$(signSrcPath)"
176-
Contents: '**'
177-
TargetFolder: $(Build.SourcesDirectory)/DSC/bin/$(buildName)/$(BuildConfiguration)
178-
OverWrite: true
179-
- pwsh: |
180-
Set-Location "$(Build.SourcesDirectory)/DSC"
181-
./build.ps1 -PackageType zip -Architecture $(buildName) -Release
182-
Copy-Item ./bin/*.zip "$(ob_outputDirectory)" -Verbose
183-
displayName: 'Zip $(buildName)'
184-
condition: succeeded()
185-
- pwsh: |
186-
Set-Location "$(Build.SourcesDirectory)/DSC"
187-
./build.ps1 -PackageType msix -Architecture $(buildName) -Release -UseX64MakeAppx
188-
Copy-Item ./bin/msix/*.msix "$(ob_outputDirectory)" -Verbose
189-
displayName: 'Create msix for $(buildName)'
190-
condition: succeeded()
90+
- template: ./DSC-Windows.yml
91+
parameters:
92+
buildName: x86_64-pc-windows-msvc
19193

19294
- job: BuildWin_arm64
19395
dependsOn: SetPackageVersion
194-
variables:
195-
buildName: aarch64-pc-windows-msvc
196-
PackageVersion: $[ dependencies.SetPackageVersion.outputs['Package.Version'] ]
197-
ob_sdl_tsa_configFile: '$(Build.SourcesDirectory)\DSC\.config\tsaoptions.json'
198-
ob_outputDirectory: '$(Build.ArtifactStagingDirectory)'
199-
repoRoot: '$(Build.SourcesDirectory)\DSC'
200-
signSrcPath: '$(Build.SourcesDirectory)\out'
201-
ob_sdl_sbom_enabled: true
202-
ob_signing_setup_enabled: true
203-
ob_sdl_codeql_compiled_enabled: true
204-
pool:
205-
type: windows
206-
hostArchitecture: arm64
207-
displayName: BuildWin_arm64
20896
steps:
209-
- checkout: self
210-
env:
211-
ob_restore_phase: true
212-
- task: CodeQL3000Init@0 # Add CodeQL Init task right before your 'Build' step.
213-
inputs:
214-
Enabled: true
215-
AnalyzeInPipeline: true
216-
Language: rust
217-
env:
218-
ob_restore_phase: true
219-
- pwsh: |
220-
$tmpdir = "$(Agent.TempDirectory)"
221-
Write-Host "##vso[task.setvariable variable=CARGO_TARGET_DIR;]$tmpdir"
222-
displayName: 🛠️ Workaround for the LoadLibrary ACCESS_VIOLATION OneBranch issue
223-
env:
224-
ob_restore_phase: true
225-
- task: RustInstaller@1
226-
inputs:
227-
rustVersion: ms-stable
228-
toolchainFeed: https://pkgs.dev.azure.com/mscodehub/Rust/_packaging/Rust/nuget/v3/index.json
229-
additionalTargets: $(buildName)
230-
displayName: Install Rust
231-
env:
232-
ob_restore_phase: true
233-
- pwsh: |
234-
Set-Location "$(Build.SourcesDirectory)/DSC"
235-
$LLVMBIN = "$($env:PROGRAMFILES)\Microsoft Visual Studio\2022\Enterprise\VC\Tools\Llvm\bin"
236-
if (!(Test-Path $LLVMBIN)) {
237-
throw "LLVM path '$LLVMBIN' does not exist"
238-
}
239-
$env:PATH += ";$LLVMBIN"
240-
write-verbose -verbose (gcm clang.exe | out-string)
241-
./build.ps1 -Release -Architecture $(buildName) -SkipLinkCheck
242-
displayName: 'Build $(buildName)'
243-
env:
244-
ob_restore_phase: true
245-
condition: succeeded()
246-
- task: CodeQL3000Finalize@0 # Add CodeQL Finalize task right after your 'Build' step.
247-
condition: always()
248-
env:
249-
ob_restore_phase: true
250-
- pwsh: |
251-
$null = New-Item -ItemType Directory -Path "$(PackageRoot)" -ErrorAction Ignore
252-
$null = New-Item -ItemType Directory -Path "$(PackageRoot)/out" -ErrorAction Ignore
253-
$null = New-Item -ItemType Directory -Path "$(signSrcPath)" -ErrorAction Ignore
254-
# workaround known issue of building in OneBranch copying from TMP folder
255-
$null = New-Item -ItemType Directory -Path "$(signSrcPath)" -ErrorAction Ignore
256-
# copy only the exes from the TMP folder since it contains intermediately built files we don't want to sign
257-
write-host 'Binaries in $(env:CARGO_TARGET_DIR)'
258-
Copy-Item -Path "$env:CARGO_TARGET_DIR/$(buildName)/$(BuildConfiguration)/*.exe" -Destination "$(signSrcPath)" -Verbose
259-
Copy-Item -Path "$(Build.SourcesDirectory)/DSC/bin/$(buildName)/$(BuildConfiguration)/*" -Recurse -Destination "$(signSrcPath)" -Verbose -Force
260-
write-host 'Binaries in $(signSrcPath)'
261-
dir -r "$(signSrcPath)"
262-
displayName: Copy built binaries
263-
env:
264-
ob_restore_phase: true
265-
condition: succeeded()
266-
- task: onebranch.pipeline.signing@1
267-
displayName: Sign 1st party files
268-
inputs:
269-
command: 'sign'
270-
signing_profile: external_distribution
271-
files_to_sign: |
272-
**\*.exe;
273-
**\*.ps1;
274-
**\*.psd1;
275-
**\*.psm1;
276-
search_root: $(signSrcPath)
277-
- task: CopyFiles@2
278-
displayName: "Copy signed files to build target dir"
279-
inputs:
280-
SourceFolder: "$(signSrcPath)"
281-
Contents: '**'
282-
TargetFolder: $(Build.SourcesDirectory)/DSC/bin/$(buildName)/$(BuildConfiguration)
283-
OverWrite: true
284-
- pwsh: |
285-
Set-Location "$(Build.SourcesDirectory)/DSC"
286-
./build.ps1 -PackageType zip -Architecture $(buildName) -Release
287-
Copy-Item ./bin/*.zip "$(ob_outputDirectory)" -Verbose
288-
displayName: 'Zip $(buildName)'
289-
condition: succeeded()
290-
- pwsh: |
291-
Set-Location "$(Build.SourcesDirectory)/DSC"
292-
./build.ps1 -PackageType msix -Architecture $(buildName) -Release -UseX64MakeAppx
293-
Copy-Item ./bin/msix/*.msix "$(ob_outputDirectory)" -Verbose
294-
displayName: 'Create msix for $(buildName)'
295-
condition: succeeded()
97+
- template: ./DSC-Windows.yml
98+
parameters:
99+
buildName: aarch64-pc-windows-msvc
296100

297101
- job: CreateMsixBundle
298102
dependsOn:
@@ -324,62 +128,6 @@ extends:
324128
displayName: 'Create msixbundle'
325129
condition: succeeded()
326130
327-
# - job: BuildLinux
328-
# dependsOn: SetPackageVersion
329-
# variables:
330-
# LinuxContainerImage: 'onebranch.azurecr.io/linux/ubuntu-2204:latest'
331-
# PackageVersion: $[ dependencies.SetPackageVersion.outputs['Package.Version'] ]
332-
# ob_outputDirectory: '$(Build.ArtifactStagingDirectory)'
333-
# displayName: Linux-x64-gnu
334-
# pool:
335-
# type: linux
336-
# steps:
337-
# - task: RustInstaller@1
338-
# inputs:
339-
# rustVersion: ms-stable
340-
# toolchainFeed: https://pkgs.dev.azure.com/mscodehub/Rust/_packaging/Rust/nuget/v3/index.json
341-
# additionalTargets: x86_64-unknown-linux-gnu
342-
# displayName: Install Rust
343-
# env:
344-
# ob_restore_phase: true
345-
# - pwsh: |
346-
# ./build.ps1 -Release -Architecture x86_64-unknown-linux-gnu
347-
# ./build.ps1 -PackageType tgz -Architecture x86_64-unknown-linux-gnu -Release
348-
# Copy-Item ./bin/*.tar.gz "$(ob_outputDirectory)"
349-
# displayName: 'Build x86_64-unknown-linux-gnu'
350-
# condition: succeeded()
351-
352-
# - job: BuildLinuxArm64
353-
# dependsOn: SetPackageVersion
354-
# variables:
355-
# LinuxContainerImage: 'onebranch.azurecr.io/linux/ubuntu-2004-arm64:latest'
356-
# PackageVersion: $[ dependencies.SetPackageVersion.outputs['Package.Version'] ]
357-
# ob_outputDirectory: '$(Build.ArtifactStagingDirectory)'
358-
# displayName: Linux-ARM64-gnu
359-
# pool:
360-
# type: linux
361-
# hostArchitecture: arm64
362-
# steps:
363-
# - task: RustInstaller@1
364-
# inputs:
365-
# rustVersion: ms-stable
366-
# toolchainFeed: https://pkgs.dev.azure.com/mscodehub/Rust/_packaging/Rust/nuget/v3/index.json
367-
# additionalTargets: aarch64-unknown-linux-gnu
368-
# displayName: Install Rust
369-
# env:
370-
# ob_restore_phase: true
371-
# - pwsh: |
372-
# apt update
373-
# apt -y install gcc-aarch64-linux-gnu
374-
# if ((openssl version -d) -match 'OPENSSLDIR: "(?<dir>.*?)"') {
375-
# $env:OPENSSL_LIB_DIR = $matches['dir']
376-
# }
377-
# ./build.ps1 -Release -Architecture aarch64-unknown-linux-gnu
378-
# ./build.ps1 -PackageType tgz -Architecture aarch64-unknown-linux-gnu -Release
379-
# Copy-Item ./bin/*.tar.gz "$(ob_outputDirectory)"
380-
# displayName: 'Build aarch64-unknown-linux-gnu'
381-
# condition: succeeded()
382-
383131
- job: BuildLinuxMusl
384132
dependsOn: SetPackageVersion
385133
variables:

.pipelines/DSC-Windows.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
parameters:
2+
- name: buildName
3+
type: string
4+
5+
variables:
6+
buildName: x86_64-pc-windows-msvc
7+
PackageVersion: $[ dependencies.SetPackageVersion.outputs['Package.Version'] ]
8+
ob_sdl_tsa_configFile: '$(Build.SourcesDirectory)\DSC\.config\tsaoptions.json'
9+
ob_outputDirectory: '$(Build.ArtifactStagingDirectory)'
10+
repoRoot: '$(Build.SourcesDirectory)\DSC'
11+
signSrcPath: '$(Build.SourcesDirectory)\out'
12+
ob_sdl_sbom_enabled: true
13+
ob_signing_setup_enabled: true
14+
ob_sdl_codeql_compiled_enabled: true
15+
16+
pool:
17+
type: windows
18+
19+
steps:
20+
- checkout: self
21+
env:
22+
ob_restore_phase: true
23+
- task: CodeQL3000Init@0 # Add CodeQL Init task right before your 'Build' step.
24+
inputs:
25+
Enabled: true
26+
AnalyzeInPipeline: true
27+
Language: rust
28+
env:
29+
ob_restore_phase: true
30+
- pwsh: |
31+
$tmpdir = "$(Agent.TempDirectory)"
32+
Write-Host "##vso[task.setvariable variable=CARGO_TARGET_DIR;]$tmpdir"
33+
displayName: 🛠️ Workaround for the LoadLibrary ACCESS_VIOLATION OneBranch issue
34+
env:
35+
ob_restore_phase: true
36+
- task: RustInstaller@1
37+
inputs:
38+
rustVersion: ms-stable
39+
toolchainFeed: https://pkgs.dev.azure.com/mscodehub/Rust/_packaging/Rust/nuget/v3/index.json
40+
additionalTargets: $(buildName)
41+
displayName: Install Rust
42+
env:
43+
ob_restore_phase: true
44+
- pwsh: |
45+
Set-Location "$(Build.SourcesDirectory)/DSC"
46+
$LLVMBIN = "$($env:PROGRAMFILES)\Microsoft Visual Studio\2022\Enterprise\VC\Tools\Llvm\bin"
47+
if (!(Test-Path $LLVMBIN)) {
48+
throw "LLVM path '$LLVMBIN' does not exist"
49+
}
50+
$env:PATH += ";$LLVMBIN"
51+
write-verbose -verbose (gcm clang.exe | out-string)
52+
./build.ps1 -Release -Architecture $(buildName) -SkipLinkCheck
53+
displayName: 'Build $(buildName)'
54+
env:
55+
ob_restore_phase: true
56+
condition: succeeded()
57+
- task: CodeQL3000Finalize@0 # Add CodeQL Finalize task right after your 'Build' step.
58+
condition: always()
59+
env:
60+
ob_restore_phase: true
61+
- pwsh: |
62+
$null = New-Item -ItemType Directory -Path "$(PackageRoot)" -ErrorAction Ignore
63+
$null = New-Item -ItemType Directory -Path "$(PackageRoot)/out" -ErrorAction Ignore
64+
$null = New-Item -ItemType Directory -Path "$(signSrcPath)" -ErrorAction Ignore
65+
# workaround known issue of building in OneBranch copying from TMP folder
66+
$null = New-Item -ItemType Directory -Path "$(signSrcPath)" -ErrorAction Ignore
67+
# copy only the exes from the TMP folder since it contains intermediately built files we don't want to sign
68+
write-host 'Binaries in $(env:CARGO_TARGET_DIR)'
69+
Copy-Item -Path "$env:CARGO_TARGET_DIR/$(buildName)/$(BuildConfiguration)/*.exe" -Destination "$(signSrcPath)" -Verbose
70+
Copy-Item -Path "$(Build.SourcesDirectory)/DSC/bin/$(buildName)/$(BuildConfiguration)/*" -Recurse -Destination "$(signSrcPath)" -Verbose -Force
71+
write-host 'Binaries in $(signSrcPath)'
72+
dir -r "$(signSrcPath)"
73+
displayName: Copy built binaries
74+
env:
75+
ob_restore_phase: true
76+
condition: succeeded()
77+
- task: onebranch.pipeline.signing@1
78+
displayName: Sign 1st party files
79+
inputs:
80+
command: 'sign'
81+
signing_profile: external_distribution
82+
files_to_sign: |
83+
**\*.exe;
84+
**\*.ps1;
85+
**\*.psd1;
86+
**\*.psm1;
87+
search_root: $(signSrcPath)
88+
- task: CopyFiles@2
89+
displayName: "Copy signed files to build target dir"
90+
inputs:
91+
SourceFolder: "$(signSrcPath)"
92+
Contents: '**'
93+
TargetFolder: $(Build.SourcesDirectory)/DSC/bin/$(buildName)/$(BuildConfiguration)
94+
OverWrite: true
95+
- pwsh: |
96+
Set-Location "$(Build.SourcesDirectory)/DSC"
97+
./build.ps1 -PackageType zip -Architecture $(buildName) -Release
98+
Copy-Item ./bin/*.zip "$(ob_outputDirectory)" -Verbose
99+
displayName: 'Zip $(buildName)'
100+
condition: succeeded()
101+
- pwsh: |
102+
Set-Location "$(Build.SourcesDirectory)/DSC"
103+
./build.ps1 -PackageType msix -Architecture $(buildName) -Release -UseX64MakeAppx
104+
Copy-Item ./bin/msix/*.msix "$(ob_outputDirectory)" -Verbose
105+
displayName: 'Create msix for $(buildName)'
106+
condition: succeeded()

0 commit comments

Comments
 (0)