diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
index 0a449948..2aca2bf8 100644
--- a/.github/workflows/rust.yml
+++ b/.github/workflows/rust.yml
@@ -2,9 +2,9 @@ name: Rust
on:
push:
- branches: [ "main", "v3.0.0" ]
+ branches: [ "main", "release/v3.0.0" ]
pull_request:
- branches: [ "main", "v3.0.0" ]
+ branches: [ "main", "release/v3.0.0" ]
paths-ignore:
- "docs/**"
- "*.md"
diff --git a/.pipelines/DSC-Official.yml b/.pipelines/DSC-Official.yml
index 3bc4351a..a32c0520 100644
--- a/.pipelines/DSC-Official.yml
+++ b/.pipelines/DSC-Official.yml
@@ -18,7 +18,6 @@ schedules:
variables:
BuildConfiguration: 'release'
PackageRoot: '$(System.ArtifactsDirectory)/Packages'
-# LinuxContainerImage: 'mcr.microsoft.com/onebranch/cbl-mariner/build:2.0'
WindowsContainerImage: 'onebranch.azurecr.io/windows/ltsc2022/vse2022:latest'
Codeql.TSAEnabled: true
@@ -85,120 +84,46 @@ extends:
Write-Host "##$vstsCommandString"
name: Package
- - job: BuildWin
+ - job: BuildWin_x64
dependsOn: SetPackageVersion
- strategy:
- matrix:
- Windows x64:
- Suffix: x64
- buildName: x86_64-pc-windows-msvc
- Windows x64_arm64:
- Suffix: arm64
- buildName: aarch64-pc-windows-msvc
variables:
- PackageVersion: $[ dependencies.SetPackageVersion.outputs['Package.Version'] ]
ob_sdl_tsa_configFile: '$(Build.SourcesDirectory)\DSC\.config\tsaoptions.json'
ob_outputDirectory: '$(Build.ArtifactStagingDirectory)'
- ob_artifactSuffix: $(Suffix)
- repoRoot: '$(Build.SourcesDirectory)\DSC'
signSrcPath: '$(Build.SourcesDirectory)\out'
ob_sdl_sbom_enabled: true
ob_signing_setup_enabled: true
ob_sdl_codeql_compiled_enabled: true
pool:
type: windows
- displayName: BuildWin
steps:
- - checkout: self
- env:
- ob_restore_phase: true
- - task: CodeQL3000Init@0 # Add CodeQL Init task right before your 'Build' step.
- inputs:
- Enabled: true
- AnalyzeInPipeline: true
- Language: rust
- env:
- ob_restore_phase: true
- - pwsh: |
- $tmpdir = "$(Agent.TempDirectory)"
- Write-Host "##vso[task.setvariable variable=CARGO_TARGET_DIR;]$tmpdir"
- displayName: 🛠️ Workaround for the LoadLibrary ACCESS_VIOLATION OneBranch issue
- env:
- ob_restore_phase: true
- - task: RustInstaller@1
- inputs:
- rustVersion: ms-stable
- toolchainFeed: https://pkgs.dev.azure.com/mscodehub/Rust/_packaging/Rust/nuget/v3/index.json
- additionalTargets: $(buildName)
- displayName: Install Rust
- env:
- ob_restore_phase: true
- - pwsh: |
- Set-Location "$(Build.SourcesDirectory)/DSC"
- $LLVMBIN = "$($env:PROGRAMFILES)\Microsoft Visual Studio\2022\Enterprise\VC\Tools\Llvm\bin"
- if (!(Test-Path $LLVMBIN)) {
- throw "LLVM path '$LLVMBIN' does not exist"
- }
- $env:PATH += ";$LLVMBIN"
- write-verbose -verbose (gcm clang.exe | out-string)
- ./build.ps1 -Release -Architecture $(buildName) -SkipLinkCheck
- displayName: 'Build $(buildName)'
- env:
- ob_restore_phase: true
- condition: succeeded()
- - task: CodeQL3000Finalize@0 # Add CodeQL Finalize task right after your 'Build' step.
- condition: always()
- env:
- ob_restore_phase: true
- - pwsh: |
- $null = New-Item -ItemType Directory -Path "$(PackageRoot)" -ErrorAction Ignore
- $null = New-Item -ItemType Directory -Path "$(PackageRoot)/out" -ErrorAction Ignore
- $null = New-Item -ItemType Directory -Path "$(signSrcPath)" -ErrorAction Ignore
- # workaround known issue of building in OneBranch copying from TMP folder
- $null = New-Item -ItemType Directory -Path "$(signSrcPath)" -ErrorAction Ignore
- # copy only the exes from the TMP folder since it contains intermediately built files we don't want to sign
- write-host 'Binaries in $(env:CARGO_TARGET_DIR)'
- Copy-Item -Path "$env:CARGO_TARGET_DIR/$(buildName)/$(BuildConfiguration)/*.exe" -Destination "$(signSrcPath)" -Verbose
- Copy-Item -Path "$(Build.SourcesDirectory)/DSC/bin/$(buildName)/$(BuildConfiguration)/*" -Recurse -Destination "$(signSrcPath)" -Verbose -Force
- write-host 'Binaries in $(signSrcPath)'
- dir -r "$(signSrcPath)"
- displayName: Copy built binaries
- env:
- ob_restore_phase: true
- condition: succeeded()
- - task: onebranch.pipeline.signing@1
- displayName: Sign 1st party files
- inputs:
- command: 'sign'
- signing_profile: external_distribution
- files_to_sign: |
- **\*.exe;
- **\*.ps1;
- **\*.psd1;
- **\*.psm1;
- search_root: $(signSrcPath)
- - task: CopyFiles@2
- displayName: "Copy signed files to build target dir"
- inputs:
- SourceFolder: "$(signSrcPath)"
- Contents: '**'
- TargetFolder: $(Build.SourcesDirectory)/DSC/bin/$(buildName)/$(BuildConfiguration)
- OverWrite: true
- - pwsh: |
- Set-Location "$(Build.SourcesDirectory)/DSC"
- ./build.ps1 -PackageType zip -Architecture $(buildName) -Release
- Copy-Item ./bin/*.zip "$(ob_outputDirectory)"
- displayName: 'Zip $(buildName)'
- condition: succeeded()
- - pwsh: |
- Set-Location "$(Build.SourcesDirectory)/DSC"
- ./build.ps1 -PackageType msix -Architecture $(buildName) -Release -UseX64MakeAppx
- Copy-Item ./bin/msix/*.msix "$(ob_outputDirectory)" -Verbose
- displayName: 'Create msix for $(buildName)'
- condition: succeeded()
+ - template: .pipelines/DSC-Windows.yml@self
+ parameters:
+ buildName: x86_64-pc-windows-msvc
+ signSrcPath: '$(signSrcPath)'
+ PackageRoot: '$(PackageRoot)'
+
+ - job: BuildWin_arm64
+ dependsOn: SetPackageVersion
+ variables:
+ ob_sdl_tsa_configFile: '$(Build.SourcesDirectory)\DSC\.config\tsaoptions.json'
+ ob_outputDirectory: '$(Build.ArtifactStagingDirectory)'
+ signSrcPath: '$(Build.SourcesDirectory)\out'
+ ob_sdl_sbom_enabled: true
+ ob_signing_setup_enabled: true
+ ob_sdl_codeql_compiled_enabled: true
+ pool:
+ type: windows
+ steps:
+ - template: .pipelines/DSC-Windows.yml@self
+ parameters:
+ buildName: aarch64-pc-windows-msvc
+ signSrcPath: '$(signSrcPath)'
+ PackageRoot: '$(PackageRoot)'
- job: CreateMsixBundle
- dependsOn: BuildWin
+ dependsOn:
+ - BuildWin_x64
+ - BuildWin_arm64
variables:
ob_outputDirectory: '$(Build.ArtifactStagingDirectory)'
ob_sdl_tsa_configFile: '$(Build.SourcesDirectory)\DSC\.config\tsaoptions.json'
@@ -210,77 +135,21 @@ extends:
steps:
- checkout: self
- download: current
- artifact: drop_BuildAndSign_BuildWinx64
+ artifact: drop_BuildAndSign_BuildWin_x64
patterns: '*.msix'
- download: current
- artifact: drop_BuildAndSign_BuildWinarm64
+ artifact: drop_BuildAndSign_BuildWin_arm64
patterns: '*.msix'
- pwsh: |
Set-Location "$(Build.SourcesDirectory)/DSC"
$null = New-Item -ItemType Directory -Path "./bin/msix" -Force -ErrorAction Ignore
- Copy-Item "$(Pipeline.Workspace)/drop_BuildAndSign_BuildWinx64/*.msix" ./bin/msix -Verbose
- Copy-Item "$(Pipeline.Workspace)/drop_BuildAndSign_BuildWinarm64/*.msix" ./bin/msix -Verbose
+ Copy-Item "$(Pipeline.Workspace)/drop_BuildAndSign_BuildWin_x64/*.msix" ./bin/msix -Verbose
+ Copy-Item "$(Pipeline.Workspace)/drop_BuildAndSign_BuildWin_arm64/*.msix" ./bin/msix -Verbose
./build.ps1 -PackageType msixbundle
Copy-Item ./bin/*.msixbundle "$(ob_outputDirectory)"
displayName: 'Create msixbundle'
condition: succeeded()
- # - job: BuildLinux
- # dependsOn: SetPackageVersion
- # variables:
- # LinuxContainerImage: 'onebranch.azurecr.io/linux/ubuntu-2204:latest'
- # PackageVersion: $[ dependencies.SetPackageVersion.outputs['Package.Version'] ]
- # ob_outputDirectory: '$(Build.ArtifactStagingDirectory)'
- # displayName: Linux-x64-gnu
- # pool:
- # type: linux
- # steps:
- # - task: RustInstaller@1
- # inputs:
- # rustVersion: ms-stable
- # toolchainFeed: https://pkgs.dev.azure.com/mscodehub/Rust/_packaging/Rust/nuget/v3/index.json
- # additionalTargets: x86_64-unknown-linux-gnu
- # displayName: Install Rust
- # env:
- # ob_restore_phase: true
- # - pwsh: |
- # ./build.ps1 -Release -Architecture x86_64-unknown-linux-gnu
- # ./build.ps1 -PackageType tgz -Architecture x86_64-unknown-linux-gnu -Release
- # Copy-Item ./bin/*.tar.gz "$(ob_outputDirectory)"
- # displayName: 'Build x86_64-unknown-linux-gnu'
- # condition: succeeded()
-
- # - job: BuildLinuxArm64
- # dependsOn: SetPackageVersion
- # variables:
- # LinuxContainerImage: 'onebranch.azurecr.io/linux/ubuntu-2004-arm64:latest'
- # PackageVersion: $[ dependencies.SetPackageVersion.outputs['Package.Version'] ]
- # ob_outputDirectory: '$(Build.ArtifactStagingDirectory)'
- # displayName: Linux-ARM64-gnu
- # pool:
- # type: linux
- # hostArchitecture: arm64
- # steps:
- # - task: RustInstaller@1
- # inputs:
- # rustVersion: ms-stable
- # toolchainFeed: https://pkgs.dev.azure.com/mscodehub/Rust/_packaging/Rust/nuget/v3/index.json
- # additionalTargets: aarch64-unknown-linux-gnu
- # displayName: Install Rust
- # env:
- # ob_restore_phase: true
- # - pwsh: |
- # apt update
- # apt -y install gcc-aarch64-linux-gnu
- # if ((openssl version -d) -match 'OPENSSLDIR: "(?
.*?)"') {
- # $env:OPENSSL_LIB_DIR = $matches['dir']
- # }
- # ./build.ps1 -Release -Architecture aarch64-unknown-linux-gnu
- # ./build.ps1 -PackageType tgz -Architecture aarch64-unknown-linux-gnu -Release
- # Copy-Item ./bin/*.tar.gz "$(ob_outputDirectory)"
- # displayName: 'Build aarch64-unknown-linux-gnu'
- # condition: succeeded()
-
- job: BuildLinuxMusl
dependsOn: SetPackageVersion
variables:
diff --git a/.pipelines/DSC-Windows.yml b/.pipelines/DSC-Windows.yml
new file mode 100644
index 00000000..3a7ec137
--- /dev/null
+++ b/.pipelines/DSC-Windows.yml
@@ -0,0 +1,99 @@
+parameters:
+ - name: buildName
+ type: string
+ - name: signSrcPath
+ type: string
+ - name: PackageRoot
+ type: string
+ - name: BuildConfiguration
+ type: string
+ default: Release
+
+steps:
+- checkout: self
+ env:
+ ob_restore_phase: true
+- task: CodeQL3000Init@0 # Add CodeQL Init task right before your 'Build' step.
+ inputs:
+ Enabled: true
+ AnalyzeInPipeline: true
+ Language: rust
+ env:
+ ob_restore_phase: true
+- pwsh: |
+ $tmpdir = "$(Agent.TempDirectory)"
+ Write-Host "##vso[task.setvariable variable=CARGO_TARGET_DIR;]$tmpdir"
+ displayName: 🛠️ Workaround for the LoadLibrary ACCESS_VIOLATION OneBranch issue
+ env:
+ ob_restore_phase: true
+- task: RustInstaller@1
+ inputs:
+ rustVersion: ms-stable
+ toolchainFeed: https://pkgs.dev.azure.com/mscodehub/Rust/_packaging/Rust/nuget/v3/index.json
+ additionalTargets: ${{ parameters.buildName }}
+ displayName: Install Rust
+ env:
+ ob_restore_phase: true
+- pwsh: |
+ Set-Location "$(Build.SourcesDirectory)/DSC"
+ $LLVMBIN = "$($env:PROGRAMFILES)\Microsoft Visual Studio\2022\Enterprise\VC\Tools\Llvm\bin"
+ if (!(Test-Path $LLVMBIN)) {
+ throw "LLVM path '$LLVMBIN' does not exist"
+ }
+ $env:PATH += ";$LLVMBIN"
+ write-verbose -verbose (gcm clang.exe | out-string)
+ ./build.ps1 -Release -Architecture ${{ parameters.buildName }} -SkipLinkCheck
+ displayName: 'Build ${{ parameters.buildName }}'
+ env:
+ ob_restore_phase: true
+ condition: succeeded()
+- task: CodeQL3000Finalize@0 # Add CodeQL Finalize task right after your 'Build' step.
+ condition: always()
+ env:
+ ob_restore_phase: true
+- pwsh: |
+ $null = New-Item -ItemType Directory -Path "${{ parameters.PackageRoot }}" -ErrorAction Ignore
+ $null = New-Item -ItemType Directory -Path "${{ parameters.PackageRoot }}/out" -ErrorAction Ignore
+ $null = New-Item -ItemType Directory -Path "${{ parameters.signSrcPath }}" -ErrorAction Ignore
+ # workaround known issue of building in OneBranch copying from TMP folder
+ $null = New-Item -ItemType Directory -Path "${{ parameters.signSrcPath }}" -ErrorAction Ignore
+ # copy only the exes from the TMP folder since it contains intermediately built files we don't want to sign
+ write-host 'Binaries in $(env:CARGO_TARGET_DIR)'
+ Copy-Item -Path "$env:CARGO_TARGET_DIR/${{ parameters.buildName }}/${{ parameters.BuildConfiguration }}/*.exe" -Destination "${{ parameters.signSrcPath }}" -Verbose
+ Copy-Item -Path "$(Build.SourcesDirectory)/DSC/bin/${{ parameters.buildName }}/${{ parameters.BuildConfiguration }}/*" -Recurse -Destination "${{ parameters.signSrcPath }}" -Verbose -Force
+ write-host 'Binaries in ${{ parameters.signSrcPath }}'
+ dir -r "${{ parameters.signSrcPath }}"
+ displayName: Copy built binaries
+ env:
+ ob_restore_phase: true
+ condition: succeeded()
+- task: onebranch.pipeline.signing@1
+ displayName: Sign 1st party files
+ inputs:
+ command: 'sign'
+ signing_profile: external_distribution
+ files_to_sign: |
+ **\*.exe;
+ **\*.ps1;
+ **\*.psd1;
+ **\*.psm1;
+ search_root: ${{ parameters.signSrcPath }}
+- task: CopyFiles@2
+ displayName: "Copy signed files to build target dir"
+ inputs:
+ SourceFolder: "${{ parameters.signSrcPath }}"
+ Contents: '**'
+ TargetFolder: $(Build.SourcesDirectory)/DSC/bin/${{ parameters.buildName }}/${{ parameters.BuildConfiguration }}
+ OverWrite: true
+- pwsh: |
+ Set-Location "$(Build.SourcesDirectory)/DSC"
+ ./build.ps1 -PackageType zip -Architecture ${{ parameters.buildName }} -Release
+ Copy-Item ./bin/*.zip "$(Build.ArtifactStagingDirectory)" -Verbose
+ displayName: 'Zip ${{ parameters.buildName }}'
+ condition: succeeded()
+- pwsh: |
+ Set-Location "$(Build.SourcesDirectory)/DSC"
+ ./build.ps1 -PackageType msix -Architecture ${{ parameters.buildName }} -Release -UseX64MakeAppx
+ Copy-Item ./bin/msix/*.msix "$(Build.ArtifactStagingDirectory)" -Verbose
+ displayName: 'Create msix for ${{ parameters.buildName }}'
+ condition: succeeded()
diff --git a/build.ps1 b/build.ps1
index 1247af66..5f303315 100644
--- a/build.ps1
+++ b/build.ps1
@@ -16,9 +16,16 @@ param(
[switch]$UseCratesIO,
[switch]$UpdateLockFile,
[switch]$Audit,
- [switch]$UseCFSAuth
+ [switch]$UseCFSAuth,
+ [switch]$Clean,
+ [switch]$Verbose
)
+$env:RUSTC_LOG=$null
+if ($Verbose) {
+ $env:RUSTC_LOG='rustc_codegen_ssa::back::link=info'
+}
+
if ($GetPackageVersion) {
$match = Select-String -Path $PSScriptRoot/dsc/Cargo.toml -Pattern '^version\s*=\s*"(?.*?)"$'
if ($null -eq $match) {
@@ -116,8 +123,15 @@ function Find-LinkExe {
}
}
+$channel = 'stable'
if ($null -ne (Get-Command rustup -ErrorAction Ignore)) {
$rustup = 'rustup'
+} elseif ($null -ne (Get-Command msrustup -ErrorAction Ignore)) {
+ $rustup = 'msrustup'
+ $channel = 'ms-stable'
+ if ($architecture -eq 'current') {
+ $env:MSRUSTUP_TOOLCHAIN = "$architecture"
+ }
} else {
$rustup = 'echo'
}
@@ -184,7 +198,6 @@ if ($architecture -eq 'current') {
$target = Join-Path $PSScriptRoot 'bin' $configuration
}
else {
- & $rustup target add $architecture
$flags += '--target'
$flags += $architecture
$path = ".\target\$architecture\$configuration"
@@ -192,6 +205,10 @@ else {
}
if (!$SkipBuild) {
+ if ($architecture -ne 'Current') {
+ & $rustup target add --toolchain $channel $architecture
+ }
+
if (Test-Path $target) {
Remove-Item $target -Recurse -ErrorAction Ignore
}
@@ -319,6 +336,10 @@ if (!$SkipBuild) {
cargo audit fix
}
+ if ($Clean) {
+ cargo clean
+ }
+
cargo build @flags
}
}
@@ -332,10 +353,10 @@ if (!$SkipBuild) {
$binary = Split-Path $project -Leaf
if ($IsWindows) {
- Copy-Item "$path/$binary.exe" $target -ErrorAction Ignore
+ Copy-Item "$path/$binary.exe" $target -ErrorAction Ignore -Verbose
}
else {
- Copy-Item "$path/$binary" $target -ErrorAction Ignore
+ Copy-Item "$path/$binary" $target -ErrorAction Ignore -Verbose
}
if (Test-Path "./copy_files.txt") {
@@ -510,7 +531,7 @@ function Find-MakeAppx() {
$makeappx
}
-$productVersion = ((Get-Content $PSScriptRoot/dsc/Cargo.toml) -match '^version\s*=\s*') -replace 'version\s*=\s*"(.*?)"', '$1'
+$productVersion = (((Get-Content $PSScriptRoot/dsc/Cargo.toml) -match '^version\s*=\s*') -replace 'version\s*=\s*"(.*?)"', '$1').Trim()
if ($packageType -eq 'msixbundle') {
if (!$IsWindows) {
@@ -565,6 +586,11 @@ if ($packageType -eq 'msixbundle') {
$displayName += "-Preview"
}
}
+ else {
+ # appx requires a version in the format of major.minor.build.revision with revision being 0
+ $productVersion += ".0"
+ }
+
Write-Verbose -Verbose "Product version is $productVersion"
$arch = if ($architecture -eq 'aarch64-pc-windows-msvc') { 'arm64' } else { 'x64' }
diff --git a/dsc/tests/dsc_config_test.tests.ps1 b/dsc/tests/dsc_config_test.tests.ps1
index 6b725467..16e26582 100644
--- a/dsc/tests/dsc_config_test.tests.ps1
+++ b/dsc/tests/dsc_config_test.tests.ps1
@@ -32,4 +32,34 @@ Describe 'dsc config test tests' {
$out.results[0].result.differingProperties | Should -Contain 'resources'
}
}
+
+ It '_inDesiredState returned is used when: inDesiredState = and same = ' -TestCases @(
+ @{ inDesiredState = $true; valueOne = 1; valueTwo = 2; same = $true }
+ @{ inDesiredState = $true; valueOne = 3; valueTwo = 4; same = $false }
+ @{ inDesiredState = $false; valueOne = 1; valueTwo = 2; same = $true }
+ @{ inDesiredState = $false; valueOne = 3; valueTwo = 4; same = $false }
+ ) {
+ param($inDesiredState, $valueOne, $valueTwo)
+
+ $configYaml = @"
+ `$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
+ resources:
+ - name: Test
+ type: Test/InDesiredState
+ properties:
+ _inDesiredState: $inDesiredState
+ valueOne: $valueOne
+ valueTwo: $valueTwo
+"@
+
+ $out = dsc config test -i $configYaml | ConvertFrom-Json
+ $LASTEXITCODE | Should -Be 0
+ $out.results[0].result.inDesiredState | Should -Be $inDesiredState
+ if ($same) {
+ $out.results[0].result.differingProperties | Should -BeNullOrEmpty
+ }
+ else {
+ $out.results[0].result.differingProperties | Should -Be @('valueOne', 'valueTwo')
+ }
+ }
}
diff --git a/dsc_lib/Cargo.lock b/dsc_lib/Cargo.lock
index 3e27073a..f267096b 100644
--- a/dsc_lib/Cargo.lock
+++ b/dsc_lib/Cargo.lock
@@ -107,9 +107,9 @@ dependencies = [
[[package]]
name = "anyhow"
-version = "1.0.96"
+version = "1.0.97"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6b964d184e89d9b6b67dd2715bc8e74cf3107fb2b529990c90cf517326150bf4"
+checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f"
[[package]]
name = "arc-swap"
@@ -182,9 +182,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
-version = "2.8.0"
+version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36"
+checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd"
[[package]]
name = "borrow-or-share"
@@ -216,15 +216,15 @@ checksum = "5ce89b21cab1437276d2650d57e971f9d548a2d9037cc231abdc0562b97498ce"
[[package]]
name = "bytes"
-version = "1.10.0"
+version = "1.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f61dac84819c6588b558454b194026eb1f09c293b9036ae9b159e74e73ab6cf9"
+checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a"
[[package]]
name = "cc"
-version = "1.2.15"
+version = "1.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c736e259eea577f443d5c86c304f9f4ae0295c43f3ba05c21f1d66b5f06001af"
+checksum = "be714c154be609ec7f5dad223a33bf1482fff90472de28f7362806e6d4832b8c"
dependencies = [
"shlex",
]
@@ -243,16 +243,16 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
[[package]]
name = "chrono"
-version = "0.4.39"
+version = "0.4.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825"
+checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c"
dependencies = [
"android-tzdata",
"iana-time-zone",
"js-sys",
"num-traits",
"wasm-bindgen",
- "windows-targets",
+ "windows-link",
]
[[package]]
@@ -303,9 +303,9 @@ checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
[[package]]
name = "console"
-version = "0.15.10"
+version = "0.15.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ea3c6ecd8059b57859df5c69830340ed3c41d30e3da0c1cbed90a96ac853041b"
+checksum = "054ccb5b10f9f2cbf51eb355ca1d05c2d279ce1804688d0db74b4733a5aeafd8"
dependencies = [
"encode_unicode",
"libc",
@@ -455,9 +455,9 @@ dependencies = [
[[package]]
name = "dyn-clone"
-version = "1.0.18"
+version = "1.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "feeef44e73baff3a26d371801df019877a9866a8c493d315ab00177843314f35"
+checksum = "1c7a8fb8a9fbf66c1f703fe16184d10ca0ee9d23be5b4436400408ba54a95005"
[[package]]
name = "either"
@@ -561,9 +561,9 @@ checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2"
[[package]]
name = "globset"
-version = "0.4.15"
+version = "0.4.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "15f1ce686646e7f1e19bf7d5533fe443a45dbfb990e00629110797578b42fb19"
+checksum = "54a1028dfc5f5df5da8a56a73e6c153c9a9708ec57232470703592a3f18e49f5"
dependencies = [
"aho-corasick",
"bstr",
@@ -846,9 +846,9 @@ dependencies = [
[[package]]
name = "itoa"
-version = "1.0.14"
+version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674"
+checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
[[package]]
name = "js-sys"
@@ -914,9 +914,9 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
[[package]]
name = "litemap"
-version = "0.7.4"
+version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104"
+checksum = "23fb14cb19457329c82206317a5663005a4d404783dc74f4252769b0d5f42856"
[[package]]
name = "lock_api"
@@ -966,7 +966,7 @@ version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46"
dependencies = [
- "bitflags 2.8.0",
+ "bitflags 2.9.0",
"cfg-if",
"cfg_aliases",
"libc",
@@ -1146,45 +1146,45 @@ checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e"
[[package]]
name = "proc-macro2"
-version = "1.0.93"
+version = "1.0.94"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99"
+checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
-version = "1.0.38"
+version = "1.0.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
+checksum = "c1f1914ce909e1658d9907913b4b91947430c7d9be598b15a1912935b8c04801"
dependencies = [
"proc-macro2",
]
[[package]]
name = "redox_syscall"
-version = "0.5.9"
+version = "0.5.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "82b568323e98e49e2a0899dcee453dd679fae22d69adf9b11dd508d1549b7e2f"
+checksum = "0b8c0c260b63a8219631167be35e6a988e9554dbd323f8bd08439c8ed1302bd1"
dependencies = [
- "bitflags 2.8.0",
+ "bitflags 2.9.0",
]
[[package]]
name = "ref-cast"
-version = "1.0.23"
+version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ccf0a6f84d5f1d581da8b41b47ec8600871962f2a528115b542b362d4b744931"
+checksum = "4a0ae411dbe946a674d89546582cea4ba2bb8defac896622d6496f14c23ba5cf"
dependencies = [
"ref-cast-impl",
]
[[package]]
name = "ref-cast-impl"
-version = "1.0.23"
+version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bcc303e793d3734489387d205e9b186fac9c6cfacedd98cbb2e8a5943595f3e6"
+checksum = "1165225c21bff1f3bbce98f5a1f889949bc902d3575308cc7b0de30b4f6d27c7"
dependencies = [
"proc-macro2",
"quote",
@@ -1295,15 +1295,15 @@ checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
[[package]]
name = "rustversion"
-version = "1.0.19"
+version = "1.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4"
+checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2"
[[package]]
name = "ryu"
-version = "1.0.19"
+version = "1.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6ea1a2d0a644769cc99faa24c3ad26b379b786fe7c36fd3c546254801650e6dd"
+checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
[[package]]
name = "same-file"
@@ -1355,9 +1355,9 @@ dependencies = [
[[package]]
name = "semver"
-version = "1.0.25"
+version = "1.0.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f79dfe2d285b0488816f30e700a7438c5a73d816b5b7d3ac72fbc48b0d185e03"
+checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0"
[[package]]
name = "serde"
@@ -1392,9 +1392,9 @@ dependencies = [
[[package]]
name = "serde_json"
-version = "1.0.139"
+version = "1.0.140"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "44f86c3acccc9c65b153fe1b85a3be07fe5515274ec9f0653b4a0875731c72a6"
+checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373"
dependencies = [
"indexmap 2.7.1",
"itoa",
@@ -1506,9 +1506,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
name = "syn"
-version = "2.0.98"
+version = "2.0.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1"
+checksum = "e02e925281e18ffd9d640e234264753c43edc62d64b2d4cf898f1bc5e75f3fc2"
dependencies = [
"proc-macro2",
"quote",
@@ -1700,9 +1700,9 @@ dependencies = [
[[package]]
name = "tree-sitter"
-version = "0.25.2"
+version = "0.25.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5168a515fe492af54c5cc8800ff8c840be09fa5168de45838afaecd3e008bce4"
+checksum = "b9ac5ea5e7f2f1700842ec071401010b9c59bf735295f6e9fa079c3dc035b167"
dependencies = [
"cc",
"regex",
@@ -1751,9 +1751,9 @@ dependencies = [
[[package]]
name = "unicode-ident"
-version = "1.0.17"
+version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "00e2473a93778eb0bad35909dff6a10d28e63f792f16ed15e404fca9d5eeedbe"
+checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
[[package]]
name = "unicode-width"
@@ -1995,6 +1995,12 @@ dependencies = [
"windows-targets",
]
+[[package]]
+name = "windows-link"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6dccfd733ce2b1753b03b6d3c65edf020262ea35e20ccdf3e288043e6dd620e3"
+
[[package]]
name = "windows-sys"
version = "0.52.0"
@@ -2092,7 +2098,7 @@ version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c"
dependencies = [
- "bitflags 2.8.0",
+ "bitflags 2.9.0",
]
[[package]]
@@ -2153,18 +2159,18 @@ dependencies = [
[[package]]
name = "zerofrom"
-version = "0.1.5"
+version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e"
+checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5"
dependencies = [
"zerofrom-derive",
]
[[package]]
name = "zerofrom-derive"
-version = "0.1.5"
+version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808"
+checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502"
dependencies = [
"proc-macro2",
"quote",
diff --git a/dsc_lib/locales/en-us.toml b/dsc_lib/locales/en-us.toml
index 17ce4540..6393e0fd 100644
--- a/dsc_lib/locales/en-us.toml
+++ b/dsc_lib/locales/en-us.toml
@@ -99,7 +99,7 @@ setUnexpectedOutput = "Command did not return expected actual output"
setUnexpectedDiff = "Command did not return expected diff output"
invokeTest = "Invoking test for '%{resource}'"
testSyntheticTest = "Resource '%{resource}' does not implement test, performing synthetic test"
-invokeTestUsing = "Invoking test on '%{resource}' using '{executable}'"
+invokeTestUsing = "Invoking test on '%{resource}' using '%{executable}'"
testVerifyOutput = "Verifying output of test on '%{resource}' using '%{executable}'"
testGroupTestResponse = "Import resource kind, returning group test response"
testNoActualState = "No actual state returned"
@@ -129,6 +129,7 @@ validateJson = "Validating against JSON: %{json}"
resourceInvalidJson = "Resource reported input JSON is not valid"
invalidArrayKey = "Unsupported array value for key '%{key}'. Only string and number is supported."
invalidKey = "Unsupported value for key '%{key}'. Only string, bool, number, and array is supported."
+inDesiredStateNotBool = "'_inDesiredState' is not a boolean"
[dscresources.dscresource]
invokeGet = "Invoking get for '%{resource}'"
diff --git a/dsc_lib/src/dscresources/command_resource.rs b/dsc_lib/src/dscresources/command_resource.rs
index e60b31c7..13c94ca1 100644
--- a/dsc_lib/src/dscresources/command_resource.rs
+++ b/dsc_lib/src/dscresources/command_resource.rs
@@ -283,11 +283,12 @@ pub fn invoke_test(resource: &ResourceManifest, cwd: &str, expected: &str) -> Re
return Err(DscError::Operation(t!("dscresources.commandResource.failedParseJson", executable = &test.executable, stdout = stdout, stderr = stderr, err = err).to_string()))
}
};
+ let in_desired_state = get_desired_state(&actual_value)?;
let diff_properties = get_diff(&expected_value, &actual_value);
Ok(TestResult::Resource(ResourceTestResponse {
desired_state: expected_value,
actual_state: actual_value,
- in_desired_state: diff_properties.is_empty(),
+ in_desired_state: in_desired_state.unwrap_or(diff_properties.is_empty()),
diff_properties,
}))
},
@@ -302,10 +303,11 @@ pub fn invoke_test(resource: &ResourceManifest, cwd: &str, expected: &str) -> Re
return Err(DscError::Command(resource.resource_type.clone(), exit_code, t!("dscresources.commandResource.testNoDiff").to_string()));
};
let diff_properties: Vec = serde_json::from_str(diff_properties)?;
+ let in_desired_state = get_desired_state(&actual_value)?;
Ok(TestResult::Resource(ResourceTestResponse {
desired_state: expected_value,
actual_state: actual_value,
- in_desired_state: diff_properties.is_empty(),
+ in_desired_state: in_desired_state.unwrap_or(diff_properties.is_empty()),
diff_properties,
}))
},
@@ -335,6 +337,19 @@ pub fn invoke_test(resource: &ResourceManifest, cwd: &str, expected: &str) -> Re
}
}
+fn get_desired_state(actual: &Value) -> Result