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: Displays a warning when a plugin from the tools-version list does not exist #1033
Conversation
If multiple plugins are not present on the system, will this error for the first it finds in the list, with a rerun required to then error on the next missing plugin? Assuming that is true, is there a way we could log/warn of all missing plugins as opposed to the first not found? |
I have rewritten the plugin installation. This approach preserves the original installation and at the same time it will report plugin's not available. It will also not stop in case there is a missing plugin. |
Great, thanks for the update. Can you write test cases to cover these scenarios to prevent regressions? |
Sure! I will try to find time this week(end) and come back with an update :) |
I think we should stop installing when a missing plugin is encountered. Some projects define plugins in the order they must be installed in, because certain plugins depend on others. Proceeding to install subsequent versions after a plugin is not found could cause problems. |
lib/commands/command-install.bash
Outdated
if [ -f "$tool_versions_path" ]; then | ||
tools_file=$(strip_tool_version_comments "$tool_versions_path" | cut -d ' ' -f 1) | ||
for plugin_name in $tools_file; do | ||
if [[ ! "${plugins_installed[*]}" =~ $plugin_name ]]; then |
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.
Is this the same logic we use elsewhere in the codebase? I think this might cause problems if two plugins share matching prefixes. For example, ag
and age
are both existing plugins right now. With this logic, age
could match the plugin name ag
.
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.
No, that is the first occurrence of that comparison. I will turn it into an exact comparison.
Fine with me, but I would like the output to show all missing plugins, as opposed to just the first encountered missing so it is a showstopper only once. |
The changes are then;
|
I think that is all. Thanks again for your work on this. @jthegedus do you have anything to add? |
Just for clarity (bolded my additions):
Thanks for tackling our feedback @threkk |
I made the changes discussed before. The tests run successfully in Ubuntu, but OSX tests look broken in general. Is this a known issue or do I need to change the code? |
@threkk, not sure about the tests. They are passing on the latest commit of the master branch. You could try rebasing your PR branch on top of latest master, although I'm not sure that will fix it. |
When I clone down your branch and run it locally (on OSX 10.15.7 (19H1323)) all but two tests pass. The two failures were:
The first test always fails for me locally (even on master) and the second only failed because I was on your branch and not the master branch when I ran the tests. So I don't see any issues here with your code. Perhaps try re-running the tests on GH or try rebasing onto latest master? |
…not exist When calling the install command, it tried to look for versions for all the plugins available and installed them. With this change, it will attempt to find versions for all the installed plugins and plugins defined in the `.tool-versions`. Fixes asdf-vm#574
This patch changes the algorithm. It preserves the original logic for the plugin resolution, but at the same time, reports entries with plugins not available.
- Changes the comparison to be strict rather than partial. - Prints a list of missing plugins. - Exists if at least one plugin is not present. - Adds unit tests.
I rebased the branch and sadly the issues still persist on OSX. This seems to be some difference between OSX and Ubuntu. I will try to reproduce on a OSX machine to pin point the issue but I can't tell exactly when I will be able. If anyone has any idea about what can be wrong, I will appreciate the help :) I have my suspicions on |
It took me some time, but finally found the problem: one of the flags was a *nix only flag and was causing the errors. Once removed, everything works as expected :) |
Thanks @threkk !! We will add |
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.
LGTM. Feel free to merge if you're happy @Stratus3D
As explained in asdf-vm#1062 asdf-vm#1033, `-P` is an option that does not exist in OSX and causes problems of compatibility.
As explained in asdf-vm#1062 asdf-vm#1033, `-P` is an option that does not exist in OSX and causes problems of compatibility.
Cool stuff! Would it be possible to cut a new release including this change? |
We will release |
This change breaks my workflow as I intentionally do not install all plugins on all my machines (depending on which I need). Is there any way to disable this feature (looking at the code I guess no) or make it so it can be disabled? |
@cmur2 I think you make a valid point. Specifically, how do these changes break your current workflow? We may want to provide a flag or configuration option so that missing plugins do not cause the install command to exit with a status of 1. |
@Stratus3D I use a shared dotfiles repo between several of my machines (e.g. work and private ones) to share a For work I might need I also have other tools like After the update to asdf-vm v0.9.0, I cannot update nodejs on my private machine anymore since asdf complains about the missing For now I used |
Summary
When calling the install command, asdf tries to look for versions for all the plugins available and installs them. With this change, it will attempt to find versions for all the installed plugins and plugins defined in the
.tool-versions
.Other Information
Fixes #574