-
-
Notifications
You must be signed in to change notification settings - Fork 119
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
Building plugins from multiple private repos #118
Comments
Could we do a weird syntax like |
Github at least has an official syntax that does what you're describing
I wonder if we should just have xcaddy support that? I tried running
|
Can you try with |
It does, but I'd still need to authenticate with my token. |
Right, then I guess that's what the |
Right, but imagine you need to authenticate to several private repos because your build requires several private plugins. Then the |
You can have multiple accounts in a netrc file, can't you? I've never used it before but a quick Google suggests you should be able to do that. |
So I assume that did the trick? |
I got sidetracked but this recently became relevant again. The problem with the In addition to the The problem with the Here's an idea of an interface to solve this: A [
{
"credential": "<personal access token for account A>",
"repos": ["github.com/private-repo-a/someplugin1", "github.com/private-repo-a/someplugin2"]
},
{
"credential": "<personal access token for account B>",
"repos": ["github.com/private-repo-b/someplugin3", "github.com/private-repo-b/someplugin4"]
}
] and behind the scenes it would be cloning and using replacements. I don't love this, but after researching this issue for many hours, there's not really anything that scales well 🤷🏿 . We could also go the direction of a more generic Regardless of the solution, we'd also need to update |
I could get behind a JSON config file for these more advanced configs... In fact, the ability to describe a specific Caddy build configuration via JSON seems elegant. |
@francislavoie as for your proposed solution, that
|
Okay cool 👍 |
So I guess the probable solution here involves having a JSON config as input as instructions to build. It would take precedence over any This would probably take some heavy refactoring; we'd need a new struct that the JSON unmarshals into, and we'd probably want to change |
I have a use-case where I want to build Caddy with plugins from multiple disparate private repos (different accounts / organizations). As an example of why this might be useful, consider the scenario when xcaddy is used in an automated build environment where users can link their private repo via Oauth to create a custom Caddy build.
Retrieving a plugin from a single private repo is trivial (just set
GOPRIVATE
and do a replace on the git remote url host, or use SSH). Multiple private plugins from different organizations would require you to make the the aforementioned changes to the environment just before eachgo get
call.I'm not sure the best way to solve this. My idea is to have
xcaddy
accept a JSON file as a param. It could include an array of "private repo configs" which each consist of the followingxCaddy would use this info to
GOPRIVATE
env var (used bygo get
to know when a repo is private),.netrc
before eachgo get
call for a private plugin (the.netrc
is used by thegit
command to authenticate with the git server.The json config could be nice because would be simple to manage in a CI/CD environment or in your Dockerfile.
Caveat: Right now I'm only thinking about private Github repos, so there might be some minor nuances to supporting / authenticating with other Git servers.
Here's an article about
go get
and private repos for more context.The text was updated successfully, but these errors were encountered: