Add flag to always authenticate when cloning public repositories (#760)

As a developer using an custom git server (e.g. Github Enterprise) I would like to be able to authenticate 
the user on repositories which are marked as public.

See issue: https://github.com/woodpecker-ci/woodpecker/issues/473

Ref: https://github.com/woodpecker-ci/woodpecker/pull/693#issuecomment-1025771162
This commit is contained in:
Zav Shotan
2022-02-08 11:55:08 -05:00
committed by GitHub
parent 8ce41788e8
commit f16525fae5
5 changed files with 19 additions and 5 deletions

View File

@@ -91,6 +91,11 @@ var flags = []cli.Flag{
Name: "open",
Usage: "enable open user registration",
},
&cli.BoolFlag{
EnvVars: []string{"WOODPECKER_AUTHENTICATE_PUBLIC_REPOS"},
Name: "authenticate-public-repos",
Usage: "Always use authentication to clone repositories even if they are public. Needed if the SCM requires to always authenticate as used by many companies.",
},
&cli.StringFlag{
EnvVars: []string{"WOODPECKER_DOCS"},
Name: "docs",

View File

@@ -271,6 +271,9 @@ func setupEvilGlobals(c *cli.Context, v store.Store, r remote.Remote) {
server.Config.Services.Senders = sender.NewRemote(endpoint)
}
// authentication
server.Config.Pipeline.AuthenticatePublicRepos = c.Bool("authenticate-public-repos")
// limits
server.Config.Pipeline.Limits.MemSwapLimit = c.Int64("limit-mem-swap")
server.Config.Pipeline.Limits.MemLimit = c.Int64("limit-mem")