From 741c16b16e712994f1de493ab84fb974d410518a Mon Sep 17 00:00:00 2001 From: "G.Reijn" <26114636+Gijsreyn@users.noreply.github.com> Date: Fri, 1 May 2026 11:37:19 +0200 Subject: [PATCH 1/3] Add manifest patterns for DSC resource discovery --- extensions/powershell/powershell.discover.ps1 | 3 +++ extensions/powershell/powershell.dsc.extension.json | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/extensions/powershell/powershell.discover.ps1 b/extensions/powershell/powershell.discover.ps1 index d8cced58a..df36f16c0 100644 --- a/extensions/powershell/powershell.discover.ps1 +++ b/extensions/powershell/powershell.discover.ps1 @@ -81,6 +81,9 @@ function Invoke-DscResourceDiscovery { '*.dsc.adaptedresource.json' '*.dsc.adaptedresource.yaml' '*.dsc.adaptedresource.yml' + '*.dsc.manifests.json' + '*.dsc.manifests.yaml' + '*.dsc.manifests.yml' ) $enumOptions = [System.IO.EnumerationOptions]@{ IgnoreInaccessible = $true; RecurseSubdirectories = $true } foreach ($pattern in $searchPatterns) { diff --git a/extensions/powershell/powershell.dsc.extension.json b/extensions/powershell/powershell.dsc.extension.json index 5323dc614..16081a13a 100644 --- a/extensions/powershell/powershell.dsc.extension.json +++ b/extensions/powershell/powershell.dsc.extension.json @@ -1,7 +1,7 @@ { "$schema": "https://aka.ms/dsc/schemas/v3/bundled/resource/manifest.json", "type": "Microsoft.PowerShell/Discover", - "version": "0.1.0", + "version": "0.1.1", "description": "Discovers DSC resources packaged in PowerShell 7 modules.", "condition": "[not(equals(tryWhich('pwsh'), null()))]", "discover": { From dff58a4e9bab596ae8edbcec5c262b2390dee1a3 Mon Sep 17 00:00:00 2001 From: "G.Reijn" <26114636+Gijsreyn@users.noreply.github.com> Date: Fri, 1 May 2026 14:10:52 +0200 Subject: [PATCH 2/3] Update tests --- dsc/tests/dsc_extension_discover.tests.ps1 | 2 +- .../powershell/powershell.discover.tests.ps1 | 39 +++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/dsc/tests/dsc_extension_discover.tests.ps1 b/dsc/tests/dsc_extension_discover.tests.ps1 index c754ae292..7b0fc17c7 100644 --- a/dsc/tests/dsc_extension_discover.tests.ps1 +++ b/dsc/tests/dsc_extension_discover.tests.ps1 @@ -26,7 +26,7 @@ Describe 'Discover extension tests' { if ($IsWindows) { $out.Count | Should -Be 3 -Because ($out | Out-String) $out[0].type | Should -BeExactly 'Microsoft.PowerShell/Discover' - $out[0].version | Should -BeExactly '0.1.0' + $out[0].version | Should -BeExactly '0.1.1' $out[0].capabilities | Should -BeExactly @('discover') $out[0].manifest | Should -Not -BeNullOrEmpty $out[1].type | Should -BeExactly 'Microsoft.Windows.Appx/Discover' diff --git a/extensions/powershell/powershell.discover.tests.ps1 b/extensions/powershell/powershell.discover.tests.ps1 index 540181fcb..783df14c8 100644 --- a/extensions/powershell/powershell.discover.tests.ps1 +++ b/extensions/powershell/powershell.discover.tests.ps1 @@ -47,6 +47,39 @@ BeforeAll { $adaptedManifestPath = Join-Path $TestDrive "fake.dsc.adaptedresource.json" $fakeAdaptedManifest | ConvertTo-Json -Depth 10 | Set-Content -Path $adaptedManifestPath + $fakeManifestList = @{ + '$schema' = "https://aka.ms/dsc/schemas/v3/bundled/resource/manifest.json" + resources = @( + @{ + type = "Test/FakeListedResource" + version = "0.1.0" + kind = "resource" + get = @{ + executable = "fakeListedResource" + args = @( + "get", + @{ + jsonInputArg = "--input" + mandatory = $true + } + ) + } + } + ) + adaptedResources = @( + @{ + type = "Test/FakeListedAdaptedResource" + kind = "resource" + version = "0.1.0" + requireAdapter = "Microsoft.Adapter/PowerShell" + path = "FakeAdapted.psd1" + } + ) + } + + $manifestListPath = Join-Path $TestDrive "fake.dsc.manifests.json" + $fakeManifestList | ConvertTo-Json -Depth 10 | Set-Content -Path $manifestListPath + $fakePsd1Path = Join-Path $TestDrive "FakeAdapted.psd1" Set-Content -Path $fakePsd1Path -Value "@{ ModuleVersion = '0.1.0' }" $script:OldPSModulePath = $env:PSModulePath @@ -162,4 +195,10 @@ Describe 'Tests for PowerShell resource discovery' { $out = & $script:discoverScript | ConvertFrom-Json $out.manifestPath | Should -Contain $adaptedManifestPath } + + It 'Should discover *.dsc.manifests.* manifest-list files' { + Remove-Item -Force -ErrorAction SilentlyContinue -Path $script:cacheFilePath + $out = & $script:discoverScript | ConvertFrom-Json + $out.manifestPath | Should -Contain $manifestListPath + } } From a6d70933328bc83ae3d6176bdc19bb48c9d99c02 Mon Sep 17 00:00:00 2001 From: "G.Reijn" <26114636+Gijsreyn@users.noreply.github.com> Date: Fri, 1 May 2026 14:39:31 +0200 Subject: [PATCH 3/3] Update version check for discovered resources to 0.1.1 --- dsc/tests/dsc_extension_discover.tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dsc/tests/dsc_extension_discover.tests.ps1 b/dsc/tests/dsc_extension_discover.tests.ps1 index 7b0fc17c7..57ab35f1b 100644 --- a/dsc/tests/dsc_extension_discover.tests.ps1 +++ b/dsc/tests/dsc_extension_discover.tests.ps1 @@ -40,7 +40,7 @@ Describe 'Discover extension tests' { } else { $out.Count | Should -Be 2 -Because ($out | Out-String) $out[0].type | Should -BeExactly 'Microsoft.PowerShell/Discover' - $out[0].version | Should -BeExactly '0.1.0' + $out[0].version | Should -BeExactly '0.1.1' $out[0].capabilities | Should -BeExactly @('discover') $out[0].manifest | Should -Not -BeNullOrEmpty $out[1].type | Should -BeExactly 'Test/Discover'