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

Shared local config doesn't work with parent dir or unexpanded paths #834

Open
Skoti opened this issue Jul 25, 2024 · 1 comment
Open

Shared local config doesn't work with parent dir or unexpanded paths #834

Skoti opened this issue Jul 25, 2024 · 1 comment

Comments

@Skoti
Copy link

Skoti commented Jul 25, 2024

I have a config like this:

version: 0.1
cli:
  version: 1.22.2
plugins:
  sources:
    - id: trunk
      ref: v1.6.1
      uri: https://github.com/trunk-io/plugins
    - id: skoti
      local: ../shared

the ../shared contains plugin.yaml and it works.

However, it stops working as soon as I change the local path to either:

  • .. or ../ - to simply indicate the parent directory
  • ~/configs/trunk or $HOME/configs/trunk - to point to the home directory via tilde expansion or env variable

Is this something that could/should be supported?
It works with ../shared or absolute paths like: /Users/skoti/configs/trunk so might be not worth adding.


If not then it should be fixed to return a proper error.

As .. or ../ makes trunk to hang for infinity ♾️ .

And the tilde expansion returns:

.trunk/trunk.yaml:9:7
 9:7  high  [skoti] '~/configs/trunk' does not exist  trunk/config-error

Unable to run check due to invalid config

Which is not true because the file exists, so I would expect something like an unrecognized path error or if we can be specific unsupported path expansion.

Interestingly, if I put a symlink ../shared/plugin.yaml to point to ~/configs/trunk/plugin.yaml via tilde expansion then it works. So looks like only the configured path is significant.

@TylerJang27
Copy link
Collaborator

Hi! This is more or less expected behavior for the moment, but I agree the UX isn't great. Some notes:

  • We don't support ../ since we recursively load plugin.yaml, files, which could lead to some unexpected results if it's also based on your current repo. Regardless, we should include a better error message if you choose a parent/ancestor of your current dir. ../shared is an officially supported use case, as you saw
  • We don't do any template resolution for that path for HOME or ~, but we certainly could! I've filed this feature request to track it, which you can upvote

Let me know if you have any other questions! We will work on improving the UX here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants