Skip to content

Commit cc9d0e9

Browse files
authored
Merge branch 'PowerShell:main' into main
2 parents 6ce773f + 78cb8a1 commit cc9d0e9

File tree

103 files changed

+4905
-3290
lines changed

Some content is hidden

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

103 files changed

+4905
-3290
lines changed

.cargo/config.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
registry-auth = true
44

55
[registries]
6-
powershell = { index = "sparse+https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell/Cargo/index/" }
6+
POWERSHELL = { index = "sparse+https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell/Cargo/index/" }
77

88
[registry]
99
global-credential-providers = ["cargo:token"]
@@ -17,4 +17,10 @@ rustflags = ["-Ccontrol-flow-guard", "-Ctarget-feature=+crt-static", "-Clink-arg
1717

1818
# The following is only needed for release builds
1919
[source.crates-io]
20-
replace-with = "powershell"
20+
replace-with = "POWERSHELL"
21+
22+
[target.aarch64-unknown-linux-gnu]
23+
linker = "aarch64-linux-gnu-gcc"
24+
25+
[target.aarch64-unknown-linux-musl]
26+
linker = "aarch64-linux-musl-gcc"

.github/workflows/rust.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,22 @@ jobs:
2828
shell: pwsh
2929
run: ./build.ps1 -test
3030

31+
build-musl:
32+
33+
runs-on: ubuntu-latest
34+
35+
steps:
36+
- uses: actions/checkout@v3
37+
- run: rustup target add x86_64-unknown-linux-musl
38+
- name: Install musl build tools
39+
run: sudo apt update && sudo apt install musl-tools -y
40+
- name: Build
41+
shell: pwsh
42+
run: ./build.ps1 -clippy -target x86_64-unknown-linux-musl
43+
- name: Run tests
44+
shell: pwsh
45+
run: ./build.ps1 -test -target x86_64-unknown-linux-musl
46+
3147
build-windows:
3248

3349
runs-on: windows-latest

.pipelines/DSC-Official.yml

Lines changed: 102 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
name: DSC-Release-$(Build.BuildId)
22
trigger: none
33

4-
parameters:
5-
- name: 'debugConsole'
6-
displayName: 'Enable debug console'
7-
type: boolean
8-
default: false
9-
104
pr:
115
branches:
126
include:
137
- onebranch
148
- release*
159

10+
schedules:
11+
- cron: '0 3 * * 1'
12+
displayName: Weekly Build
13+
branches:
14+
include:
15+
- main
16+
always: true
17+
1618
variables:
1719
BuildConfiguration: 'release'
1820
PackageRoot: '$(System.ArtifactsDirectory)/Packages'
19-
LinuxContainerImage: 'mcr.microsoft.com/onebranch/cbl-mariner/build:2.0'
20-
WindowsContainerImage: onebranch.azurecr.io/windows/ltsc2019/vse2022:latest
21+
# LinuxContainerImage: 'mcr.microsoft.com/onebranch/cbl-mariner/build:2.0'
22+
LinuxContainerImage: 'onebranch.azurecr.io/linux/ubuntu-2204:latest'
23+
WindowsContainerImage: 'onebranch.azurecr.io/windows/ltsc2022/vse2022:latest'
2124

2225
resources:
2326
repositories:
@@ -30,7 +33,12 @@ extends:
3033
template: v2/OneBranch.Official.CrossPlat.yml@onebranchTemplates
3134
parameters:
3235
featureFlags:
33-
debugConsole: ${{ parameters.debugConsole }}
36+
WindowsHostVersion:
37+
Disk: Large
38+
Version: 2022
39+
Network: KS1 # note that this property is sticky so commenting out will use the previous set one
40+
# Currently can't be used as some NPM pkgs like tree-sitter-cli reach out to GitHub to get the actual zip pkg
41+
# Network: NetLock
3442
customTags: 'ES365AIMigrationTooling'
3543
globalSdl:
3644
disableLegacyManifest: true
@@ -51,7 +59,7 @@ extends:
5159
apiscan:
5260
enabled: false
5361

54-
stages:
62+
stages:
5563
- stage: BuildAndSign
5664
displayName: Build Native Binaries
5765
dependsOn: []
@@ -60,6 +68,7 @@ extends:
6068
displayName: Set PackageVersion
6169
pool:
6270
type: windows
71+
vmImage: windows-latest
6372
variables:
6473
repoRoot: $(Build.SourcesDirectory)\DSC
6574
ob_sdl_tsa_configFile: $(Build.SourcesDirectory)\DSC\.config\tsaoptions.json
@@ -124,24 +133,15 @@ extends:
124133
displayName: Install Rust
125134
env:
126135
ob_restore_phase: true
127-
- task: AzureCLI@2
128-
inputs:
129-
azureSubscription: az-PowerShell-feed-ingestion
130-
scriptType: 'pscore'
131-
scriptLocation: 'inlineScript'
132-
inlineScript: |
133-
$accessToken = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv
134-
135-
# Set the access token as a secret, so it doesn't get leaked in the logs
136-
Write-Host "##vso[task.setsecret]$accessToken"
137-
$header = "Bearer $accessToken"
138-
Write-Host "##vso[task.setvariable variable=CARGO_REGISTRIES_POWERSHELL_TOKEN]$header"
139-
displayName: 'Get Azure DevOps Token'
140-
env:
141-
ob_restore_phase: true
142136
- pwsh: |
143137
Set-Location "$(Build.SourcesDirectory)/DSC"
144-
./build.ps1 -Release -Architecture $(buildName) -SkipLinkCheck -UseCFS
138+
$LLVMBIN = "$($env:PROGRAMFILES)\Microsoft Visual Studio\2022\Enterprise\VC\Tools\Llvm\bin"
139+
if (!(Test-Path $LLVMBIN)) {
140+
throw "LLVM path '$LLVMBIN' does not exist"
141+
}
142+
$env:PATH += ";$LLVMBIN"
143+
write-verbose -verbose (gcm clang.exe | out-string)
144+
./build.ps1 -Release -Architecture $(buildName) -SkipLinkCheck
145145
displayName: 'Build $(buildName)'
146146
env:
147147
ob_restore_phase: true
@@ -201,16 +201,20 @@ extends:
201201
dependsOn: BuildWin
202202
variables:
203203
ob_outputDirectory: '$(Build.ArtifactStagingDirectory)'
204+
ob_sdl_tsa_configFile: '$(Build.SourcesDirectory)\DSC\.config\tsaoptions.json'
205+
ob_sdl_sbom_enabled: true
206+
ob_signing_setup_enabled: true
207+
ob_sdl_codeql_compiled_enabled: true
204208
pool:
205209
type: windows
206210
steps:
211+
- checkout: self
207212
- download: current
208213
artifact: drop_BuildAndSign_BuildWinx64
209214
patterns: '*.msix'
210215
- download: current
211216
artifact: drop_BuildAndSign_BuildWinarm64
212217
patterns: '*.msix'
213-
- checkout: self
214218
- pwsh: |
215219
Set-Location "$(Build.SourcesDirectory)/DSC"
216220
$null = New-Item -ItemType Directory -Path "./bin/msix" -Force -ErrorAction Ignore
@@ -221,25 +225,6 @@ extends:
221225
displayName: 'Create msixbundle'
222226
condition: succeeded()
223227
224-
- job: PublishSigned
225-
dependsOn: BuildWin
226-
variables:
227-
signOutPath: $[ dependencies.BuildWin.outputs['signOutPath.signOutPath'] ]
228-
ob_sdl_tsa_configFile: $(Build.SourcesDirectory)\DSC\.config\tsaoptions.json
229-
ob_outputDirectory: '$(Build.ArtifactStagingDirectory)'
230-
ob_sdl_sbom_enabled: false
231-
ob_signing_setup_enabled: false
232-
ob_sdl_codeql_compiled_enabled: false
233-
pool:
234-
type: windows
235-
steps:
236-
- task: CopyFiles@2
237-
displayName: "Copy Files for 'PublishPipelineArtifact@1' publish task"
238-
inputs:
239-
SourceFolder: $(signOutPath)
240-
Contents: '**'
241-
TargetFolder: $(Build.ArtifactStagingDirectory)/signed
242-
243228
- job: BuildLinux
244229
dependsOn: SetPackageVersion
245230
variables:
@@ -257,23 +242,8 @@ extends:
257242
displayName: Install Rust
258243
env:
259244
ob_restore_phase: true
260-
- task: AzureCLI@2
261-
inputs:
262-
azureSubscription: az-PowerShell-feed-ingestion
263-
scriptType: 'pscore'
264-
scriptLocation: 'inlineScript'
265-
inlineScript: |
266-
$accessToken = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv
267-
268-
# Set the access token as a secret, so it doesn't get leaked in the logs
269-
Write-Host "##vso[task.setsecret]$accessToken"
270-
$header = "Bearer $accessToken"
271-
Write-Host "##vso[task.setvariable variable=CARGO_REGISTRIES_POWERSHELL_TOKEN]$header"
272-
displayName: 'Get Azure DevOps Token'
273-
env:
274-
ob_restore_phase: true
275245
- pwsh: |
276-
./build.ps1 -Release -Architecture x86_64-unknown-linux-gnu -UseCFS
246+
./build.ps1 -Release -Architecture x86_64-unknown-linux-gnu
277247
./build.ps1 -PackageType tgz -Architecture x86_64-unknown-linux-gnu -Release
278248
Copy-Item ./bin/*.tar.gz "$(ob_outputDirectory)"
279249
displayName: 'Build x86_64-unknown-linux-gnu'
@@ -287,7 +257,6 @@ extends:
287257
displayName: Linux-ARM64-gnu
288258
pool:
289259
type: linux
290-
hostArchitecture: arm64
291260
steps:
292261
- task: RustInstaller@1
293262
inputs:
@@ -297,26 +266,72 @@ extends:
297266
displayName: Install Rust
298267
env:
299268
ob_restore_phase: true
300-
- task: AzureCLI@2
269+
- pwsh: |
270+
apt update
271+
apt -y install gcc-aarch64-linux-gnu
272+
./build.ps1 -Release -Architecture aarch64-unknown-linux-gnu
273+
./build.ps1 -PackageType tgz -Architecture aarch64-unknown-linux-gnu -Release
274+
Copy-Item ./bin/*.tar.gz "$(ob_outputDirectory)"
275+
displayName: 'Build aarch64-unknown-linux-gnu'
276+
condition: succeeded()
277+
278+
- job: BuildLinuxMusl
279+
dependsOn: SetPackageVersion
280+
variables:
281+
PackageVersion: $[ dependencies.SetPackageVersion.outputs['Package.Version'] ]
282+
ob_outputDirectory: '$(Build.ArtifactStagingDirectory)'
283+
displayName: Linux-x64-musl
284+
pool:
285+
type: linux
286+
steps:
287+
- task: RustInstaller@1
301288
inputs:
302-
azureSubscription: az-PowerShell-feed-ingestion
303-
scriptType: 'pscore'
304-
scriptLocation: 'inlineScript'
305-
inlineScript: |
306-
$accessToken = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv
289+
rustVersion: ms-stable
290+
toolchainFeed: https://pkgs.dev.azure.com/mscodehub/Rust/_packaging/Rust/nuget/v3/index.json
291+
additionalTargets: x86_64-unknown-linux-musl
292+
displayName: Install Rust
293+
env:
294+
ob_restore_phase: true
295+
- pwsh: |
296+
apt update
297+
apt -y install musl-tools
298+
./build.ps1 -Release -Architecture x86_64-unknown-linux-musl
299+
./build.ps1 -PackageType tgz -Architecture x86_64-unknown-linux-musl -Release
300+
Copy-Item ./bin/*.tar.gz "$(ob_outputDirectory)"
301+
displayName: 'Build x86_64-unknown-linux-musl'
302+
condition: succeeded()
307303
308-
# Set the access token as a secret, so it doesn't get leaked in the logs
309-
Write-Host "##vso[task.setsecret]$accessToken"
310-
$header = "Bearer $accessToken"
311-
Write-Host "##vso[task.setvariable variable=CARGO_REGISTRIES_POWERSHELL_TOKEN]$header"
312-
displayName: 'Get Azure DevOps Token'
304+
- job: BuildLinuxArm64Musl
305+
dependsOn: SetPackageVersion
306+
variables:
307+
PackageVersion: $[ dependencies.SetPackageVersion.outputs['Package.Version'] ]
308+
ob_outputDirectory: '$(Build.ArtifactStagingDirectory)'
309+
displayName: Linux-ARM64-musl
310+
pool:
311+
type: linux
312+
steps:
313+
- task: RustInstaller@1
314+
inputs:
315+
rustVersion: ms-stable
316+
toolchainFeed: https://pkgs.dev.azure.com/mscodehub/Rust/_packaging/Rust/nuget/v3/index.json
317+
additionalTargets: aarch64-unknown-linux-musl
318+
displayName: Install Rust
313319
env:
314320
ob_restore_phase: true
315321
- pwsh: |
316-
./build.ps1 -Release -Architecture aarch64-unknown-linux-gnu -UseCFS
317-
./build.ps1 -PackageType tgz -Architecture aarch64-unknown-linux-gnu -Release
322+
$env:CC_aarch64_unknown_linux_musl='clang'
323+
$env:AR_aarch64_unknown_linux_musl='llvm-ar'
324+
$env:CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-Clink-self-contained=yes -Clinker=rust-lld"
325+
apt update
326+
apt -y install clang
327+
apt -y install llvm
328+
apt -y install musl-tools
329+
apt -y install gcc-multilib
330+
rustup default stable-aarch64-unknown-linux-musl
331+
./build.ps1 -Release -Architecture aarch64-unknown-linux-musl
332+
./build.ps1 -PackageType tgz -Architecture aarch64-unknown-linux-musl -Release
318333
Copy-Item ./bin/*.tar.gz "$(ob_outputDirectory)"
319-
displayName: 'Build aarch64-unknown-linux-gnu'
334+
displayName: 'Build aarch64-unknown-linux-musl'
320335
condition: succeeded()
321336
322337
- job: BuildMac
@@ -345,23 +360,8 @@ extends:
345360
displayName: Install Rust
346361
env:
347362
ob_restore_phase: true
348-
- task: AzureCLI@2
349-
inputs:
350-
azureSubscription: az-PowerShell-feed-ingestion
351-
scriptType: 'pscore'
352-
scriptLocation: 'inlineScript'
353-
inlineScript: |
354-
$accessToken = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv
355-
356-
# Set the access token as a secret, so it doesn't get leaked in the logs
357-
Write-Host "##vso[task.setsecret]$accessToken"
358-
$header = "Bearer $accessToken"
359-
Write-Host "##vso[task.setvariable variable=CARGO_REGISTRIES_POWERSHELL_TOKEN]$header"
360-
displayName: 'Get Azure DevOps Token'
361-
env:
362-
ob_restore_phase: true
363363
- pwsh: |
364-
./build.ps1 -Release -Architecture $(buildName) -UseCFS
364+
./build.ps1 -Release -Architecture $(buildName)
365365
./build.ps1 -PackageType tgz -Architecture $(buildName) -Release
366366
Copy-Item ./bin/*.tar.gz "$(ob_outputDirectory)"
367367
Write-Host "##vso[artifact.upload containerfolder=release;artifactname=release]$(ob_outputDirectory)/DSC-$(PackageVersion)-$(buildName).tar.gz"
@@ -370,9 +370,9 @@ extends:
370370
371371
- stage: Release
372372
dependsOn: BuildAndSign
373+
condition: ne(variables['Build.Reason'], 'Schedule')
373374
variables:
374375
PackageVersion: $[ dependencies.SetPackageVersion.outputs['Package.Version'] ]
375-
drop: $(Pipeline.Workspace)/drop_build_main
376376
jobs:
377377
- job: Validation
378378
displayName: Manual validation
@@ -392,10 +392,17 @@ extends:
392392
pool:
393393
type: windows
394394
variables:
395-
ob_outputDirectory: '$(Build.SourcesDirectory)'
395+
ob_outputDirectory: '$(Build.ArtifactStagingDirectory)'
396+
ob_sdl_sbom_enabled: false
397+
ob_signing_setup_enabled: false
398+
ob_sdl_codeql_compiled_enabled: false
399+
drop: $(Pipeline.Workspace)/drop_build_main
396400
steps:
397401
- download: current
398402
displayName: Download artifacts
403+
patterns: |
404+
'**/*.zip'
405+
'**/*.tar.gz'
399406
- task: GitHubRelease@1
400407
displayName: Create GitHub release
401408
inputs:

.vscode/settings.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"rust-analyzer.linkedProjects": [
33
"./dsc/Cargo.toml",
44
"./dsc_lib/Cargo.toml",
5+
"./echo/Cargo.toml",
56
"./osinfo/Cargo.toml",
67
"./registry/Cargo.toml",
78
"./runcommandonset/Cargo.toml",
@@ -21,5 +22,8 @@
2122
"schemas/2024/04/bundled/config/document.vscode.json": "**.dsc.{yaml,yml,config.yaml,config.yml}",
2223
"schemas/2024/04/bundled/resource/manifest.vscode.json": "**.dsc.resource.{yaml,yml}"
2324
},
24-
"sarif-viewer.connectToGithubCodeScanning": "off"
25+
"sarif-viewer.connectToGithubCodeScanning": "off",
26+
"vscode-nmake-tools.workspaceBuildDirectories": [
27+
"."
28+
]
2529
}

0 commit comments

Comments
 (0)