Open chausner opened 3 years ago
What would be really nice is if we could test manifests in Windows containers, since the Sandbox is extremely inflexible for anything other than occasional tests (you can't customize the base image outside of the intial bootstrap PowerShell script that you have to run every time, for example). The biggest problem with it is that you can only run one at a time, so you have to wait for the installer to finish before running the next one (a gigantic bottleneck if you want to test multiple architectures or scopes or something). You also have to have Windows 10 Pro/Enterprise to run Sandbox, so you couldn't use it in CI environments that run on Windows Server.
I've been playing around with Docker for Windows and getting winget running under that environment, and it works for everything except msix packages which fail with an unknown error (I don't know if that's winget or something with appx provisioning though). The biggest problem is that there isn't a way to get RDP or a console up in the container even though you can run explorer.exe, but other than that they are a lot more flexible. (Does anyone know why that is? TermService is available in the microsoft/windows
container image, it starts, I enable RDP in PowerShell but I cannot connect to it. Are there libraries missing?)
FYI, I have opened https://github.com/microsoft/winget-cli/issues/2081 to basically add the SandboxTest.ps1 functionality to winget (as opposed to wingetcreate).
If the goal is to "just" validate/verify manifests, then sure, it would be nice to have that functionality in wingetcreate. But SandboxTest.ps1 is fine for that as well, since you (usually) need to have a local winget-pkgs repo available anyway (right?). I.e. I don't see that much added benefit having it in wingetcreate, but maybe I am missing something?
On the other hand, I think there are more use-cases for using winget in the sandbox, e.g. for debugging (apart from winget-related functionality), running apps in a clean environment, or just trying out applications. You could use manifests from remote repos as well (which SandboxTest.ps1 does not support AFAICT).
At least on Win11, which bundles winget by default, it feels counter-intuitive to me, if it is not available in the sandbox there as well.
(Sidenote: The winget-pkgs README instructs to validate and test new manifests with winget, not wingetcreate, probably because manifests have to work with winget in the end?)
Please upvote https://github.com/microsoft/winget-cli/issues/2081, should you agree.
@jedieaston The windows container idea sounds quite appealing as well. The downside is that you would have to have docker installed for that, correct? I wonder if it would suffice to have winget available in the Windows image? (In any case this sounds like a separate issue).
Description of the new feature/enhancement
We already have the SandboxTest.ps1 script to test manifests in the Windows Sandbox, which is super useful but currently does not integrate well with wingetcreate. I suggest to include a command in wingetcreate to perform the same more conveniently via the tool. We might even want to consider adding a prompt to the manifest creation process, asking whether to test the installation in the sandbox before submitting a PR.
Proposed technical implementation details (optional)
In essence, wingetcreate could do exactly the same as the SandboxTest.ps1 script, just integrated into the tool.