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

feat: adding install method on minikube download #173

Merged
merged 3 commits into from
Oct 21, 2024

Conversation

axel7083
Copy link
Contributor

Following #172

When we CliTool#registerInstall and CliTool#registerUpdate we need a method to download and install the binary, instead of repeating the code between those two object, we can create a unique method install taking the artifact as argument. Why ? Because we have a bit of logic:

  1. download
  2. try to install system wide
  3. if system success return system path otherwise return download path

And having this method avoid repeating the same lines.

ℹ️ Trust the process... almost at the end :)

@axel7083 axel7083 requested a review from benoitf as a code owner October 18, 2024 12:56
src/download.ts Outdated
try {
destFile = await installBinaryToSystem(destFile, 'minikube');
} catch (err: unknown) {
console.debug('Cannot install system wide', err);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be reported at error level ?

also is it expected that we don't fail ? (report an error) it's like we're silently ignoring that we can't install it system wide ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but I would expect it's an issue if we can't

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what is the expected behaviour in the current main branch we have the doUpdate which try to install system wide

https://github.com/containers/podman-desktop-extension-minikube/blob/1ca9e7a481f5a596ddc4b6b45ed893482165bdfe/src/extension.ts#L329-L337

if it fails, just cannot update the binary, and need to restart

The status bar install seems to ask the user:

https://github.com/containers/podman-desktop-extension-minikube/blob/5ba894d30a3a10ab65d3181e0f049f9ff0c01cf1/src/minikube-installer.ts#L151

So my proposal, following your comment would be

  1. download in extension folder
  2. ask user to install system wide ?
  3. yes => try, if fails, create a notification error
  4. no => don't try to install system wide

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems a better way involving the user yes

@axel7083 axel7083 requested a review from benoitf October 21, 2024 08:47
let destFile = await this.download(release);

const result = await window.showInformationMessage(
`minikube binary has been successfully downloaded.\n\nWould you like to install it system-wide for accessibility on the command line? This will require administrative privileges.`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add the version of minikube in the text

@axel7083 axel7083 merged commit d822f1e into podman-desktop:main Oct 21, 2024
5 checks passed
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.

2 participants