Feature: Update to JSON Plugin Schema to Support Private Plugin Sources
Summary
The pull request introduces the ability to add plugins from private sources, which includes GitHub, GitLab, Bitbucket and arbitrary hosts. The JSON schema was reworked to be more declarative, which forces the user declare components of the addressed location. Changing the structure allows for future flexibility, and was needed in my case when working with repositories only accessible through an AWS tunnel. Part of the issue I encountered while trying to use the existing parsing logic is GitLab supports up to 20 subgroup levels ("group/subgroup/repo"). The existing parsing logic for GitHub style URIs was insufficient and also reduces flexibility for type of hosting locations that could be theoretically used.
While these changes make the include section more verbose, I believe the verbosity is a positive.
In short, the plugin declaration syntax goes from something like this:
"include": [
"github:<org>/<repo>?dir=<plugin-dir>"
]
to
"include": [
{
"type": "github",
"owner": "org",
"repo": "repository",
"dir": "subdir"
}
]
An example of privately hosted plugins accessible through SSH:
"include": [
{
"type": "ssh",
"host": "localhost",
"port": 1234,
"owner": "org",
"repo": "repository",
"dir": "subdir"
}
]
How was it tested?
New unit tests were added to internal/plugin/git_test.go, and this has been tested in by creating several repos to use as a test-bed, and ensuring they can be installed by declaring them in the devbox.json. Additionally, I have used this for my desired purpose, which is to access Devbox plugins only accessible in a privately hosted GitLab repo behind an AWS tunnel.
Addtional unit tests can be added if preferred. Please let me know what changes/improvements you'd like to see.
Thank you in advance for taking the time to review my pull request!