Skip to content

Commit ddf9b76

Browse files
authored
Merge branch 'PowerShell:main' into main
2 parents a42a1c5 + b52b5cb commit ddf9b76

File tree

42 files changed

+1240
-241
lines changed

Some content is hidden

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

42 files changed

+1240
-241
lines changed

.github/workflows/rust.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@ env:
1515
CARGO_TERM_COLOR: always
1616

1717
jobs:
18-
build-linux:
18+
# build-linux:
1919

20-
runs-on: ubuntu-latest
20+
# runs-on: ubuntu-latest
2121

22-
steps:
23-
- uses: actions/checkout@v3
24-
- name: Build
25-
shell: pwsh
26-
run: ./build.ps1 -clippy
27-
- name: Run tests
28-
shell: pwsh
29-
run: ./build.ps1 -test
22+
# steps:
23+
# - uses: actions/checkout@v3
24+
# - name: Build
25+
# shell: pwsh
26+
# run: ./build.ps1 -clippy
27+
# - name: Run tests
28+
# shell: pwsh
29+
# run: ./build.ps1 -test
3030

31-
build-musl:
31+
build-linux:
3232

3333
runs-on: ubuntu-latest
3434

.pipelines/DSC-Official.yml

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pr:
55
branches:
66
include:
77
- onebranch
8-
- release*
8+
- release/v*
99

1010
schedules:
1111
- cron: '0 3 * * 1'
@@ -33,7 +33,7 @@ extends:
3333
template: v2/OneBranch.Official.CrossPlat.yml@onebranchTemplates
3434
parameters:
3535
featureFlags:
36-
WindowsHostVersion:
36+
WindowsHostVersion:
3737
Disk: Large
3838
Version: 2022
3939
Network: KS1 # note that this property is sticky so commenting out will use the previous set one
@@ -59,7 +59,7 @@ extends:
5959
apiscan:
6060
enabled: false
6161

62-
stages:
62+
stages:
6363
- stage: BuildAndSign
6464
displayName: Build Native Binaries
6565
dependsOn: []
@@ -225,61 +225,61 @@ extends:
225225
displayName: 'Create msixbundle'
226226
condition: succeeded()
227227
228-
- job: BuildLinux
229-
dependsOn: SetPackageVersion
230-
variables:
231-
LinuxContainerImage: 'onebranch.azurecr.io/linux/ubuntu-2204:latest'
232-
PackageVersion: $[ dependencies.SetPackageVersion.outputs['Package.Version'] ]
233-
ob_outputDirectory: '$(Build.ArtifactStagingDirectory)'
234-
displayName: Linux-x64-gnu
235-
pool:
236-
type: linux
237-
steps:
238-
- task: RustInstaller@1
239-
inputs:
240-
rustVersion: ms-stable
241-
toolchainFeed: https://pkgs.dev.azure.com/mscodehub/Rust/_packaging/Rust/nuget/v3/index.json
242-
additionalTargets: x86_64-unknown-linux-gnu
243-
displayName: Install Rust
244-
env:
245-
ob_restore_phase: true
246-
- pwsh: |
247-
./build.ps1 -Release -Architecture x86_64-unknown-linux-gnu
248-
./build.ps1 -PackageType tgz -Architecture x86_64-unknown-linux-gnu -Release
249-
Copy-Item ./bin/*.tar.gz "$(ob_outputDirectory)"
250-
displayName: 'Build x86_64-unknown-linux-gnu'
251-
condition: succeeded()
228+
# - job: BuildLinux
229+
# dependsOn: SetPackageVersion
230+
# variables:
231+
# LinuxContainerImage: 'onebranch.azurecr.io/linux/ubuntu-2204:latest'
232+
# PackageVersion: $[ dependencies.SetPackageVersion.outputs['Package.Version'] ]
233+
# ob_outputDirectory: '$(Build.ArtifactStagingDirectory)'
234+
# displayName: Linux-x64-gnu
235+
# pool:
236+
# type: linux
237+
# steps:
238+
# - task: RustInstaller@1
239+
# inputs:
240+
# rustVersion: ms-stable
241+
# toolchainFeed: https://pkgs.dev.azure.com/mscodehub/Rust/_packaging/Rust/nuget/v3/index.json
242+
# additionalTargets: x86_64-unknown-linux-gnu
243+
# displayName: Install Rust
244+
# env:
245+
# ob_restore_phase: true
246+
# - pwsh: |
247+
# ./build.ps1 -Release -Architecture x86_64-unknown-linux-gnu
248+
# ./build.ps1 -PackageType tgz -Architecture x86_64-unknown-linux-gnu -Release
249+
# Copy-Item ./bin/*.tar.gz "$(ob_outputDirectory)"
250+
# displayName: 'Build x86_64-unknown-linux-gnu'
251+
# condition: succeeded()
252252

253-
- job: BuildLinuxArm64
254-
dependsOn: SetPackageVersion
255-
variables:
256-
LinuxContainerImage: 'onebranch.azurecr.io/linux/ubuntu-2004-arm64:latest'
257-
PackageVersion: $[ dependencies.SetPackageVersion.outputs['Package.Version'] ]
258-
ob_outputDirectory: '$(Build.ArtifactStagingDirectory)'
259-
displayName: Linux-ARM64-gnu
260-
pool:
261-
type: linux
262-
hostArchitecture: arm64
263-
steps:
264-
- task: RustInstaller@1
265-
inputs:
266-
rustVersion: ms-stable
267-
toolchainFeed: https://pkgs.dev.azure.com/mscodehub/Rust/_packaging/Rust/nuget/v3/index.json
268-
additionalTargets: aarch64-unknown-linux-gnu
269-
displayName: Install Rust
270-
env:
271-
ob_restore_phase: true
272-
- pwsh: |
273-
apt update
274-
apt -y install gcc-aarch64-linux-gnu
275-
if ((openssl version -d) -match 'OPENSSLDIR: "(?<dir>.*?)"') {
276-
$env:OPENSSL_LIB_DIR = $matches['dir']
277-
}
278-
./build.ps1 -Release -Architecture aarch64-unknown-linux-gnu
279-
./build.ps1 -PackageType tgz -Architecture aarch64-unknown-linux-gnu -Release
280-
Copy-Item ./bin/*.tar.gz "$(ob_outputDirectory)"
281-
displayName: 'Build aarch64-unknown-linux-gnu'
282-
condition: succeeded()
253+
# - job: BuildLinuxArm64
254+
# dependsOn: SetPackageVersion
255+
# variables:
256+
# LinuxContainerImage: 'onebranch.azurecr.io/linux/ubuntu-2004-arm64:latest'
257+
# PackageVersion: $[ dependencies.SetPackageVersion.outputs['Package.Version'] ]
258+
# ob_outputDirectory: '$(Build.ArtifactStagingDirectory)'
259+
# displayName: Linux-ARM64-gnu
260+
# pool:
261+
# type: linux
262+
# hostArchitecture: arm64
263+
# steps:
264+
# - task: RustInstaller@1
265+
# inputs:
266+
# rustVersion: ms-stable
267+
# toolchainFeed: https://pkgs.dev.azure.com/mscodehub/Rust/_packaging/Rust/nuget/v3/index.json
268+
# additionalTargets: aarch64-unknown-linux-gnu
269+
# displayName: Install Rust
270+
# env:
271+
# ob_restore_phase: true
272+
# - pwsh: |
273+
# apt update
274+
# apt -y install gcc-aarch64-linux-gnu
275+
# if ((openssl version -d) -match 'OPENSSLDIR: "(?<dir>.*?)"') {
276+
# $env:OPENSSL_LIB_DIR = $matches['dir']
277+
# }
278+
# ./build.ps1 -Release -Architecture aarch64-unknown-linux-gnu
279+
# ./build.ps1 -PackageType tgz -Architecture aarch64-unknown-linux-gnu -Release
280+
# Copy-Item ./bin/*.tar.gz "$(ob_outputDirectory)"
281+
# displayName: 'Build aarch64-unknown-linux-gnu'
282+
# condition: succeeded()
283283

284284
- job: BuildLinuxMusl
285285
dependsOn: SetPackageVersion

.vscode/settings.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"rust-analyzer.linkedProjects": [
33
"./dsc/Cargo.toml",
44
"./dsc_lib/Cargo.toml",
5-
"./echo/Cargo.toml",
5+
"./dscecho/Cargo.toml",
66
"./osinfo/Cargo.toml",
77
"./registry/Cargo.toml",
88
"./runcommandonset/Cargo.toml",
@@ -25,5 +25,6 @@
2525
"sarif-viewer.connectToGithubCodeScanning": "off",
2626
"vscode-nmake-tools.workspaceBuildDirectories": [
2727
"."
28-
]
28+
],
29+
"azure-pipelines.1ESPipelineTemplatesSchemaFile": true
2930
}

build.ps1

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ param(
1515
[switch]$UseX64MakeAppx,
1616
[switch]$UseCratesIO,
1717
[switch]$UpdateLockFile,
18-
[switch]$Audit
18+
[switch]$Audit,
19+
[switch]$UseCFSAuth
1920
)
2021

2122
if ($GetPackageVersion) {
@@ -47,6 +48,8 @@ $filesForWindowsPackage = @(
4748
'wmi.resource.ps1',
4849
'windows_baseline.dsc.yaml',
4950
'windows_inventory.dsc.yaml'
51+
'dsc_default.settings.json',
52+
'dsc.settings.json'
5053
)
5154

5255
$filesForLinuxPackage = @(
@@ -61,7 +64,9 @@ $filesForLinuxPackage = @(
6164
'powershell.dsc.resource.json',
6265
'psDscAdapter/',
6366
'RunCommandOnSet.dsc.resource.json',
64-
'runcommandonset'
67+
'runcommandonset',
68+
'dsc_default.settings.json',
69+
'dsc.settings.json'
6570
)
6671

6772
$filesForMacPackage = @(
@@ -76,7 +81,9 @@ $filesForMacPackage = @(
7681
'powershell.dsc.resource.json',
7782
'psDscAdapter/',
7883
'RunCommandOnSet.dsc.resource.json',
79-
'runcommandonset'
84+
'runcommandonset',
85+
'dsc_default.settings.json',
86+
'dsc.settings.json'
8087
)
8188

8289
# the list of files other than the binaries which need to be executable
@@ -191,21 +198,25 @@ if (!$SkipBuild) {
191198
${env:CARGO_SOURCE_crates-io_REPLACE_WITH} = $null
192199
$env:CARGO_REGISTRIES_CRATESIO_INDEX = $null
193200

194-
if ($null -eq (Get-Command 'az' -ErrorAction Ignore)) {
195-
throw "Azure CLI not found"
196-
}
201+
if ($UseCFSAuth -or $null -ne $env:TF_BUILD) {
202+
if ($null -eq (Get-Command 'az' -ErrorAction Ignore)) {
203+
throw "Azure CLI not found"
204+
}
197205

198-
if ($null -ne $env:CARGO_REGISTRIES_POWERSHELL_TOKEN) {
199-
Write-Host "Using existing token"
200-
} else {
201-
Write-Host "Getting token"
202-
$accessToken = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv
203-
if ($LASTEXITCODE -ne 0) {
204-
Write-Warning "Failed to get access token, use 'az login' first, or use '-useCratesIO' to use crates.io. Proceeding with anonymous access."
205-
} else {
206-
$header = "Bearer $accessToken"
207-
$env:CARGO_REGISTRIES_POWERSHELL_TOKEN = $header
208-
$env:CARGO_REGISTRIES_POWERSHELL_CREDENTIAL_PROVIDER = 'cargo:token'
206+
if ($null -ne (Get-Command az -ErrorAction Ignore)) {
207+
Write-Host "Getting token"
208+
$accessToken = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv
209+
if ($LASTEXITCODE -ne 0) {
210+
Write-Warning "Failed to get access token, use 'az login' first, or use '-useCratesIO' to use crates.io. Proceeding with anonymous access."
211+
} else {
212+
$header = "Bearer $accessToken"
213+
$env:CARGO_REGISTRIES_POWERSHELL_INDEX = "sparse+https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell~force-auth/Cargo/index/"
214+
$env:CARGO_REGISTRIES_POWERSHELL_TOKEN = $header
215+
$env:CARGO_REGISTRIES_POWERSHELL_CREDENTIAL_PROVIDER = 'cargo:token'
216+
}
217+
}
218+
else {
219+
Write-Warning "Azure CLI not found, proceeding with anonymous access."
209220
}
210221
}
211222
}
@@ -655,7 +666,16 @@ if ($packageType -eq 'msixbundle') {
655666
}
656667
}
657668

658-
$packageName = "DSC-$productVersion-$architecture.tar"
669+
# for Linux, we only build musl as its statically linked, so we remove the musl suffix
670+
$productArchitecture = if ($architecture -eq 'aarch64-unknown-linux-musl') {
671+
'aarch64-linux'
672+
} elseif ($architecture -eq 'x86_64-unknown-linux-musl') {
673+
'x86_64-linux'
674+
} else {
675+
$architecture
676+
}
677+
678+
$packageName = "DSC-$productVersion-$productArchitecture.tar"
659679
$tarFile = Join-Path $PSScriptRoot 'bin' $packageName
660680
tar cvf $tarFile -C $tgzTarget .
661681
if ($LASTEXITCODE -ne 0) {

dsc/Cargo.lock

Lines changed: 15 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dsc/Cargo.toml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "dsc"
3-
version = "3.0.0-preview.11"
3+
version = "3.1.0-preview.1"
44
edition = "2021"
55

66
[profile.release]
@@ -11,22 +11,22 @@ opt-level = 2
1111
lto = true
1212

1313
[dependencies]
14-
clap = { version = "4.5.17", features = ["derive"] }
15-
clap_complete = { version = "4.5.28" }
16-
crossterm = { version = "0.28.1" }
17-
ctrlc = { version = "3.4.0" }
14+
clap = { version = "4.5", features = ["derive"] }
15+
clap_complete = { version = "4.5" }
16+
crossterm = { version = "0.28" }
17+
ctrlc = { version = "3.4" }
1818
dsc_lib = { path = "../dsc_lib" }
1919
indicatif = { version = "0.17" }
20-
jsonschema = { version = "0.23.0", default-features = false }
21-
path-absolutize = { version = "3.1.1" }
20+
jsonschema = { version = "0.23", default-features = false }
21+
path-absolutize = { version = "3.1" }
2222
# reqwest = { version = "0.12.8", features = ["native-tls"], default-features = false }
23-
schemars = { version = "0.8.12" }
24-
serde = { version = "1.0.210", features = ["derive"] }
25-
serde_json = { version = "1.0.128", features = ["preserve_order"] }
26-
serde_yaml = { version = "0.9.3" }
23+
schemars = { version = "0.8" }
24+
serde = { version = "1.0", features = ["derive"] }
25+
serde_json = { version = "1.0", features = ["preserve_order"] }
26+
serde_yaml = { version = "0.9" }
2727
syntect = { version = "5.0", features = ["default-fancy"], default-features = false }
28-
sysinfo = { version = "0.32.0" }
29-
thiserror = "1.0.52"
28+
sysinfo = { version = "0.32" }
29+
thiserror = "1.0"
3030
tracing = { version = "0.1.37" }
31-
tracing-subscriber = { version = "0.3.17", features = ["ansi", "env-filter", "json"] }
32-
tracing-indicatif = { version = "0.3.6" }
31+
tracing-subscriber = { version = "0.3", features = ["ansi", "env-filter", "json"] }
32+
tracing-indicatif = { version = "0.3" }

dsc/assertion.dsc.resource.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"config",
3838
"--as-group",
3939
"test",
40-
"--as-get"
40+
"--as-config"
4141
],
4242
"input": "stdin",
4343
"return": "state"

0 commit comments

Comments
 (0)