Skip to content

Building plugins from multiple private repos #118

Description

@yroc92

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 each go 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 following

  • User name
  • Password / token
  • Repo url

xCaddy would use this info to

  1. Set GOPRIVATE env var (used by go get to know when a repo is private),
  2. Assemble a temporary .netrc before each go get call for a private plugin (the .netrc is used by the git 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.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions