-
Notifications
You must be signed in to change notification settings - Fork 245
feat(smoke-tests): test MSI installer for on Windows COMPASS-8707 #6640
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import path from 'node:path'; | ||
|
|
||
| import type { InstalledAppInfo, InstallablePackage } from './types'; | ||
| import { execute, ExecuteFailure } from '../execute'; | ||
|
|
||
| // See https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/msiexec | ||
|
|
||
| export function installWindowsMSI({ | ||
| appName, | ||
| filepath, | ||
| destinationPath, | ||
| }: InstallablePackage): InstalledAppInfo { | ||
| const installDirectory = path.resolve(destinationPath, appName); | ||
| const appPath = path.resolve(installDirectory, `${appName}.exe`); | ||
|
|
||
| function uninstall() { | ||
| execute('msiexec', ['/uninstall', filepath, '/passive']); | ||
| } | ||
|
|
||
| // Installing an MSI which is already installed is a no-op | ||
| // So we uninstall the MSI first (which will use the PackageCode to find the installed application) | ||
| // It is fine if the uninstall exists with status 1605, as this happens if the app wasn't already installed. | ||
| try { | ||
| uninstall(); | ||
| } catch (err) { | ||
| if (err instanceof ExecuteFailure && err.status === 1605) { | ||
| console.log( | ||
| "Uninstalling before installing failed, which is expected if the app wasn't already installed" | ||
| ); | ||
| } else { | ||
| throw err; | ||
| } | ||
| } | ||
|
Comment on lines
+20
to
+33
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I noticed the |
||
|
|
||
| execute('msiexec', [ | ||
| '/package', | ||
| filepath, | ||
| '/passive', | ||
| `APPLICATIONROOTDIRECTORY=${installDirectory}`, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I found this variable by running Here's a list of other variables that might be interesting to tweak: |
||
| ]); | ||
|
|
||
| // Check that the executable will run without being quarantined or similar | ||
| execute(appPath, ['--version']); | ||
|
|
||
| return { | ||
| appPath: installDirectory, | ||
| uninstall, | ||
| }; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume windows_setup referred to the .exe, i.e. COMPASS-8706?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh 👀 You're right 👍