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

Add AdvancedInstaller (exe) type and Default Switches #2617

Closed
wants to merge 7 commits into from

Conversation

Trenly
Copy link
Contributor

@Trenly Trenly commented Oct 21, 2022

  • Have you signed the Contributor License Agreement?
  • Are you working against an Issue?
    • No. I noticed that several (~100+) packages use exe's built with Advanced Installer and that they all had the same switches. I felt that having a dedicated installer type for this would save contributors from having to add installer switches and expected return codes for this type of executable. Additionally, it would show good faith and reciprocity towards Advanced Installer as they mention winget on their page about Finding Silent Install Switches

Microsoft Reviewers: Open in CodeFlow

@Trenly Trenly requested a review from a team as a code owner October 21, 2022 04:47
@vedantmgoyal9
Copy link
Contributor

@yao-msft
Copy link
Contributor

@denelon, do we want to take this in as part of v1.4 or we'll include it in v1.5? Seems like it'd be better to do some e2e validations before we take in a new InstallerType support.

@yao-msft
Copy link
Contributor

For adding support of a new type, it'd be better to add the basic install, upgrade, uninstall workflow tests in Workflow.cpp in unit tests to exercise the whole flow, and 1 basic install, uninstall tests in e2e tests.

@yao-msft
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Trenly
Copy link
Contributor Author

Trenly commented Oct 21, 2022

For adding support of a new type, it'd be better to add the basic install, upgrade, uninstall workflow tests in Workflow.cpp in unit tests to exercise the whole flow, and 1 basic install, uninstall tests in e2e tests.

I completely agree; However - I have no clue what I'm doing when it comes to writing (or running) the tests. I took what I saw from other unit tests and think I kind of understood them, but I really have no idea. Any guidance that you can provide here would be appreciated.

Regarding the e2e tests - I think I understand the code portion of it. I see where the manifests are written, I see how the test cases are running the install/uninstall, What I'm not exactly sure on is how to generate / build / include the actual exe file for testing. I presume this would have to be included as either a) A separate project with a build output, or b) Taking the Taking the AppInstallerTestExeInstaller.exe and re-packaging it with AdvancedInstaller, then placing it in the TestData folder. Again, this is something I don't really know how to do myself, but if there's someone who can guide me through it, I'd be happy to learn.

@yao-msft
Copy link
Contributor

Sorry I should provide more details in my previous comments.

Regarding unit tests, they should be added to WorkFlow.cpp under AppInstallerCliTests peoject, the project builds as an exe, you can just run the exe to run the tests. For Workflow tests specifically, we create a fake source with predefined query like here , then we create the command directly and override some workflows as necessary like here, finally we verify the installer is successfully invoked with expected args. You can maybe write something similar to this test
Same for upgrade and uninstall flow

Regarding e2e tests, it would be p2 as I believe most advancedInstaller should execute like an exe And e2e tests is quite complex to setup. But if there's time to add one , please just use the existing AppInstallerTestExeInstaller.exe, winget wants to test the installer is invoked as expected(not the installer itself is working as expected or not). If you add a new manifest to the Manifests folder where other test manifests sit, it should be picked up and included in a test source automatically.

By the way, I just saw Com api needs to be updated and hooked up accordingly here too.

@Trenly
Copy link
Contributor Author

Trenly commented Oct 21, 2022

Regarding unit tests, they should be added to WorkFlow.cpp under AppInstallerCliTests peoject, the project builds as an exe, you can just run the exe to run the tests. For Workflow tests specifically, we create a fake source with predefined query like here , then we create the command directly and override some workflows as necessary like here, finally we verify the installer is successfully invoked with expected args. You can maybe write something similar to this test Same for upgrade and uninstall flow

Got it; I think my understanding was correct, I'll wait for the code review to see how badly I messed up.

Regarding e2e tests, it would be p2 as I believe most advancedInstaller should execute like an exe And e2e tests is quite complex to setup. But if there's time to add one , please just use the existing AppInstallerTestExeInstaller.exe, winget wants to test the installer is invoked as expected(not the installer itself is working as expected or not). If you add a new manifest to the Manifests folder where other test manifests sit, it should be picked up and included in a test source automatically.

Got it. I'll take a look and see what I can do

By the way, I just saw Com api needs to be updated and hooked up accordingly here too.

I think I got those as part of my initial commit?
image

@yao-msft
Copy link
Contributor

Regarding

I think I got those as part of my initial commit?

That should be good I think, maybe I overlooked this one..

@SpecterShell
Copy link
Contributor

Advanced Installer returns the same exit code as MSI's except -1 and 1, according to https://www.advancedinstaller.com/user-guide/exe-setup-file.html.

@Trenly
Copy link
Contributor Author

Trenly commented Oct 22, 2022

Advanced Installer returns the same exit code as MSI's except -1 and 1, according to https://www.advancedinstaller.com/user-guide/exe-setup-file.html.

I must have missed that; Will update

@yao-msft
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Trenly
Copy link
Contributor Author

Trenly commented Oct 26, 2022

Azure Pipelines successfully started running 1 pipeline(s).

I cri. For some reason it won't let me run the tests locally, seems like its related to my setup though. It's complaining the VS2019 build tools aren't installed when they are.

Would you be able to help me identify where the error is?

@yao-msft
Copy link
Contributor

Would you be able to help me identify where the error is?

The pipeline shows 10 tests failed, some seems not directly related to this change. Do you mind if I clone your branch and directly push the fix while testing?

@Trenly
Copy link
Contributor Author

Trenly commented Oct 26, 2022

Would you be able to help me identify where the error is?

The pipeline shows 10 tests failed, some seems not directly related to this change. Do you mind if I clone your branch and directly push the fix while testing?

I don't mind at all; If you have any suggestions on how I can improve too, I'm happy to learn
Edit: I'd like to rebase this on master first to ensure the additional expected return codes can be used

@yao-msft
Copy link
Contributor

Edit: I'd like to rebase this on master first to ensure the additional expected return codes can be used

Sure, thanks

@Trenly Trenly force-pushed the AdvancedInstaller branch from 37c3aac to 2707216 Compare October 26, 2022 20:05
@Trenly
Copy link
Contributor Author

Trenly commented Oct 26, 2022

Edit: I'd like to rebase this on master first to ensure the additional expected return codes can be used

Sure, thanks

Rebased and pushed

@yao-msft
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Trenly
Copy link
Contributor Author

Trenly commented Oct 27, 2022

/azp run

Thank you, I think I see why it was erroring now with the commits you added

@yao-msft
Copy link
Contributor

Though the tests were fixed, I just realized AdvancedInstaller is an installer authoring tool that supports exe, msi, msix, appv, etc. We may need to reevaluate how we approach this installer type, if some advanced installer exe was actually just a bootstrapper for some msi(I may just be making things up based on my initial very basic exploration), the upgrade will be broken. Since we are going to have a release candidate for v1.4 soon, we'll have to revisit and take this change in v1.5 or future after we have time to think this through.

@Trenly
Copy link
Contributor Author

Trenly commented Oct 27, 2022

Though the tests were fixed, I just realized AdvancedInstaller is an installer authoring tool that supports exe, msi, msix, appv, etc. We may need to reevaluate how we approach this installer type, if some advanced installer exe was actually just a bootstrapper for some msi(I may just be making things up based on my initial very basic exploration), the upgrade will be broken. Since we are going to have a release candidate for v1.4 soon, we'll have to revisit and take this change in v1.5 or future after we have time to think this through.

Fair enough; I'll convert to draft for now then

@Trenly Trenly marked this pull request as draft October 27, 2022 01:58
@Trenly
Copy link
Contributor Author

Trenly commented Oct 27, 2022

I would add onto this, though, that msi and msix already have their own installer types (and appv isn't a supported type anyways). It wouldn't be insurmountable to document that the advancedInstaller type is specifically for exe's. I do understand the concern that some advancedInstaller exe's are just bootstrappers, but this can easily be solved with AppsAndFeaturesEntries putting the InstallerType as msi.

@SpecterShell
Copy link
Contributor

While some AI installers such as Nutstore.Nutstore write WindowsInstaller = 1 to their ARP entries and would be identified as msi installers by WinGet, there are also some AI installers such as Cocos.CocosDashboard doesn't do that and would be identified as normal exe installers.

@SpecterShell
Copy link
Contributor

SpecterShell commented Oct 27, 2022

MSI installers built by Advanced Installer uses APPDIR as installation directory instead of TARGETDIR and INSTALLDIR, so it may be necessary to add advanced installer (msi) to installer types.

@Trenly
Copy link
Contributor Author

Trenly commented Oct 27, 2022

In that case, would changing this to advInstallerExe suffice, which would allow for advInstallerMsi as well?

@SpecterShell
Copy link
Contributor

Yes.

@Trenly
Copy link
Contributor Author

Trenly commented Nov 1, 2022

In that case, would changing this to advInstallerExe suffice, which would allow for advInstallerMsi as well?

@yao-msft Thoughts on this approach?

@yao-msft
Copy link
Contributor

yao-msft commented Nov 1, 2022

In that case, would changing this to advInstallerExe suffice, which would allow for advInstallerMsi as well?

@yao-msft Thoughts on this approach?

More granular definitely works. If winget is to support AdvancedInstaller, we need some investigation and testing to be done internally to see how much we need to support them. From the discussion above, I think we need at least advInstallerExe and advInstalleMsi, it does not look very good if winget only supports "partial" of an installer technology. Mainly, the team may need a bit more time to try and understand what this installer technology is doing and decide how much we will support.

@Trenly
Copy link
Contributor Author

Trenly commented May 12, 2023

Going to close this due to it being extremely far behind on commits, no immediate need for it, and it would be easier to redo the changes than to try and fix the merge conflicts.

@Trenly Trenly closed this May 12, 2023
@Trenly Trenly deleted the AdvancedInstaller branch May 12, 2023 03:55
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.

4 participants