Add arg to pass file extensions to discover extensions#1598
Draft
SteveL-MSFT wants to merge 1 commit into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the DSC “discover” extension protocol to (1) pass DSC manifest file extensions into discover extensions at runtime and (2) allow discover extensions to return manifest content directly (not only a manifest path). It also updates the built-in Appx and PowerShell discover extensions plus adds test coverage for the new extensions-arg behavior.
Changes:
- Added a new discover
argskind (extensionsArg) and a new discover stdout shape supportingmanifestContent. - Updated the Appx and PowerShell discover extensions to use the new extensions list argument.
- Added a Pester test validating that the extensions list is received and used by a discover extension.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
lib/dsc-lib/src/extensions/discover.rs |
Adds extensionsArg processing and introduces manifestContent support in discover results. |
lib/dsc-lib/src/discovery/command_discovery.rs |
Exposes manifest extension constants and makes load_adapted_resource_manifest public for reuse. |
lib/dsc-lib/locales/en-us.toml |
Fixes the placeholder used for the invalid extension manifest message. |
extensions/test/discover/discover.ps1 |
Updates the test discover extension to accept extensions input and emit manifestContent. |
extensions/powershell/powershell.dsc.extension.json |
Passes the new extensionsArg to the PowerShell discover script. |
extensions/powershell/powershell.discover.ps1 |
Consumes the passed extension list to drive discovery patterns. |
extensions/appx/appx.dsc.extension.json |
Passes the new extensionsArg to the Appx discover script. |
extensions/appx/appx-discover.ps1 |
Consumes the passed extension list to drive Get-ChildItem -Include patterns. |
dsc/tests/dsc_extension_discover.tests.ps1 |
Adds a new Pester test ensuring extensionsArg is received and used. |
Comment on lines
+117
to
+126
| let imported_manifest = match serde_json::from_value::<ImportedManifest>(manifest_value.clone()) { | ||
| Ok(manifest) => manifest, | ||
| Err(err) => { | ||
| // see if adapted resource manifest | ||
| let adapted_resource_manifest = match serde_json::from_value::<adapted_resource_manifest::AdaptedDscResourceManifest>(manifest_value.clone()) { | ||
| Ok(manifest) => manifest, | ||
| Err(err) => { | ||
| return Err(DscError::Json(err)); | ||
| } | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
extensionsArgtodiscoverextensions that passes a comma separated string of all the manifest file extensions so they don't need to hardcode them and keep them up to datediscoverextensions to return not just the path to a manifest but also the content of the manifest directlyPR Context
Fix #1222
FIx #1195