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

Ask if a different version of a pkg should be installed when theres an existing installation #92

Merged
merged 11 commits into from Sep 13, 2019

Conversation

terev
Copy link
Contributor

@terev terev commented Aug 19, 2019

This pr addresses a portion of #17 . It prompts the user to ask if they would like to overwrite their existing installation of a package with a new image. This was already possible via a forced installation but this wasn't evident to me at first at least.

@codecov-io
Copy link

codecov-io commented Aug 19, 2019

Codecov Report

Merging #92 into master will decrease coverage by 7.44%.
The diff coverage is 30.86%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #92      +/-   ##
==========================================
- Coverage    47.6%   40.16%   -7.45%     
==========================================
  Files          12       13       +1     
  Lines         439      717     +278     
==========================================
+ Hits          209      288      +79     
- Misses        211      405     +194     
- Partials       19       24       +5
Impacted Files Coverage Δ
cmd/install.go 8.33% <0%> (-1.84%) ⬇️
packages/manager.go 65.82% <0%> (-4.45%) ⬇️
packages/package.go 61.9% <34.78%> (-11.96%) ⬇️
packages/package_diff.go 34.84% <34.84%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fca86f8...b35e956. Read the comment docs.

Copy link
Contributor

@tjamet tjamet left a comment

Choose a reason for hiding this comment

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

Please update the messages and try to provide the list of changes to be added/removed when updating a package

packages/package.go Outdated Show resolved Hide resolved
packages/package.go Outdated Show resolved Hide resolved
cmd/install.go Outdated Show resolved Hide resolved
cmd/install.go Show resolved Hide resolved
cmd/install.go Outdated Show resolved Hide resolved
cmd/install.go Outdated Show resolved Hide resolved
@tjamet
Copy link
Contributor

tjamet commented Aug 21, 2019

Thanks for your contribution though, this feature is pretty nice, just need a bit more polishing to be amazing!

@terev
Copy link
Contributor Author

terev commented Aug 24, 2019

@tjamet I've made some changes and have replied with questions I could use your opinion about. I have another feature branched off of this one that I'd like to submit if we get this merged.

In case you're curious, the other feature is an option to automatically detect the path to an executable file in the given image and set the entrypoint. This seems like a nice feature so that public images can be used more easily. I've been using it to switch versions of golang and ruby locally when i need to. When developing this I referred to #20 for ideas. https://github.com/terev/whalebrew/tree/detect-entrypoint

@terev
Copy link
Contributor Author

terev commented Aug 29, 2019

@bfirsh looking for another review on this one if someone has time

Copy link
Contributor

@tjamet tjamet left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution
There are some nits we can address here or in a different PR

cmd/install.go Outdated Show resolved Hide resolved
packages/package.go Outdated Show resolved Hide resolved
packages/package.go Outdated Show resolved Hide resolved
@terev
Copy link
Contributor Author

terev commented Sep 2, 2019

@tjamet is there a discord group or something where we could talk about the project? I have a few questions

@tjamet
Copy link
Contributor

tjamet commented Sep 3, 2019

there is no discord group so far, shall you send the questions by email?

@terev
Copy link
Contributor Author

terev commented Sep 9, 2019

@tjamet I've modified the output provided when there's changes to an existing installation of a package. I've also added the functionality to only ask the user about permission changes when installing a different image for a package. Sure that would be good my email is on my profile.

@terev terev requested a review from tjamet September 9, 2019 06:28
@terev
Copy link
Contributor Author

terev commented Sep 10, 2019

Some sample output:

./whalebrew install cmd:v1.0.1
Looks like you already have cmd:test installed as /usr/local/bin/cmd.
Would you like to change cmd:test to cmd:v1.0.1? (y/n) [y]: y
Updating this package will remove some of its current permissions:

* Read the environment variable W
* Read the file or directory "a"

Updating this package will modify some of its current permissions

* Read changed to read and write of the file or directory "~/.aws"

Is this okay? (y/n) [y]: y
🐳  Modified /usr/local/bin/cmd to use cmd:v1.0.1

@terev terev force-pushed the master branch 2 times, most recently from b329cac to 8b6f302 Compare September 10, 2019 06:24
Copy link
Contributor

@tjamet tjamet left a comment

Choose a reason for hiding this comment

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

One concern, but can be solved independently
merging

if changed, diff, err := installed.HasChanges(ctx, cli); err != nil {
return err
} else if changed {
fmt.Println("There are differences between the installed version of the package and the image:")
Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer a stated message like

Updating this package would be granted different permissions
Added access to environment variables:
<...>

@tjamet tjamet merged commit c3ac8df into whalebrew:master Sep 13, 2019
@terev
Copy link
Contributor Author

terev commented Sep 14, 2019

@tjamet Thank you so much for having a look at these changes! I really appreciate this project and the potential it has to be really useful. Thank you for maintaining it and being part of it's success.

I'm going to be working on a new pr soon that will allow installing public images without the need for a predefined entrypoint. This idea is along the lines of what is detailed here #20 . This will enable things like easily running arbitrary versions of interpreters or even golang :)

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.

None yet

3 participants