Evaluate environment variables in the local plugin path#2639
Evaluate environment variables in the local plugin path#2639mikeland73 merged 1 commit intojetify-com:mainfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR enables evaluation of environment variables in the local plugin path, allowing dynamic root directories for plugin sources.
- Uses
os.ExpandEnvto expand environment variables inLocalPlugin.Path() - No other functional changes
Comments suppressed due to low confidence (2)
internal/plugin/local.go:58
- Add unit tests for
LocalPlugin.Path()to verify that environment variables inref.Pathare correctly expanded.
path := os.ExpandEnv(l.ref.Path)
internal/plugin/local.go:57
- [nitpick] Update or add a doc comment for
Path()to indicate that it now expands environment variables in the provided path.
func (l *LocalPlugin) Path() string {
|
Looks pretty straightforward to me. @mikeland73 any pitfalls you see with this? |
|
This is good. Only caveat is that environment variables defined in Another approach could be to do the expansion before determining plugin type (i.e. local, remote, etc). That way we could do something like: which would make it nicer to develop remote plugins (currently at Jetify we use this go plugin in a private repo and it's a bit annoying to test plugin updates) Anyway let's not let perfect be enemy of good, will merge this. We can improve in follow ups. |
Summary
Fixes #2638
See issue for description of the problem. This PR is just a one-line change to evaluate current environment variables as devbox assembles the path for local plugins. This will allow things like a dynamic root directory for plugin source.
How was it tested?
Built devbox locally with code change and copied it to /usr/local/bin/devbox. Refreshed global environment and plugins defined with an environment variable in the path now resolve properly.
Community Contribution License
All community contributions in this pull request are licensed to the project
maintainers under the terms of the
Apache 2 License.
By creating this pull request, I represent that I have the right to license the
contributions to the project maintainers under the Apache 2 License as stated in
the
Community Contribution License.