Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement export WinGetPackage DSC resource #5074

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Gijsreyn
Copy link
Contributor

@Gijsreyn Gijsreyn commented Dec 16, 2024


Adds the export method on WinGetPackage class, just like some other resources in the winget-dsc repository.

Microsoft Reviewers: Open in CodeFlow

@Gijsreyn Gijsreyn requested a review from a team as a code owner December 16, 2024 11:05
@denelon
Copy link
Contributor

denelon commented Dec 16, 2024

@Gijsreyn what does the output look like for export. I want to make sure we have parity in the resource to be able to use "set" on the same output so logically (assuming there are no dependencies/conflicts), the resource can install those packages.

@Gijsreyn
Copy link
Contributor Author

@denelon here you have an example output:

image

@Trenly
Copy link
Contributor

Trenly commented Dec 16, 2024

@denelon here you have an example output:

image

If you use ConvertTo-JSON and pipe that output toa file, can that raw JSON file be used directly with Winget Import (from the cli, not cmdlet)

@Gijsreyn
Copy link
Contributor Author

image

@denelon
Copy link
Contributor

denelon commented Dec 16, 2024

Does it return an array of all packages?

We have a command for generating a configuration file from the current state of the device:
winget configure export -o <output file> in experimental status.
The goal is to be able to run that command and the output is a configuration file of the set of installed packages (the configurations for the ones that are DSC v3, and the Windows Settings.

The current "export" / "import" format would still be supported, but I'd like to make the command smart enough that it could do either the packages.json format or the WinGet Configuration YAML format over the fullness of time.

@Gijsreyn
Copy link
Contributor Author

Thanks for both replies. Yes it indeed returns an array of all packages. I knew about the experimental feature; currently, it is YAML, if I'm not mistaken. It doesn't fully follow the DSC schematics. However, if the command does it with the V3 schema (which is also in experimental?) in the future, this PR becomes obsolete.

@denelon
Copy link
Contributor

denelon commented Dec 16, 2024

We're adding experimental support to leverage DSC v3 for configuration (WinGet will also support the current configuration schema). We're planning to make WinGet a DSC v3 resource so we can use that to get/set/test/export. With the new experimental feature enabled at that point, we should be closer to where we want to be.

@denelon
Copy link
Contributor

denelon commented Dec 16, 2024

How would you envision the work in this PR being used. I just want to make sure we're not confusing folks with all the different mechanisms :) As long as we have good guidance and the right use cases, I'm fine with adding export to the current Microsoft.WinGet.DSC resource, but I want to move intentionally :)

@Gijsreyn
Copy link
Contributor Author

Gijsreyn commented Dec 16, 2024

Got it Demitrius. I was just filling the gap between winget-dsc and the one in this repository. Since Export is the new method introduced in the DSC repository, I thought it was beneficial for users to beware of it. The Microsoft.WinGet.DSC module is more popular, so showing the users that it is available might help bridge the line between DSC, WinGet, and PowerShell.

I do note that it would be helpful to provide guidance for users.

@denelon
Copy link
Contributor

denelon commented Dec 16, 2024

I understand. My main concern is that if someone were to run the following command, they would subsequently be able to run winget configure packages.winget and all the packages they had on their system coming from a configured source would be installed on the new system:

winget configure export --package Microsoft.AppInstaller --module Microsoft.WinGet.DSC --resource WinGetPackage --output packages.winget

@Gijsreyn
Copy link
Contributor Author

Gijsreyn commented Dec 17, 2024

Mhm... I get your point, Demitrius. I have a strong feeling that there is an underlying question hidden here. Executing the above command will not really work because the properties within the DSC resource are different unless they can be added to the command call itself.

Nevertheless, the output of a DSC resource will not follow the schematics defined in WinGet. Now, I'm considering solutions to bridge the gap between WinGet and DSC. It would easily be solvable by providing a static method that converts it to a JSON string, expecting the format WinGet expects.

Maybe a talk with Steve and Mikey would be worth a shot to discuss the options?

@denelon
Copy link
Contributor

denelon commented Dec 17, 2024

Yeah, we're actively in discussions around how we're going to support both DSC v2 resources as well as DSC v3 resources, and how the WinGet Configuration Export is going to behave.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants