Skip to content

Commit

Permalink
Merge branch 'master' into do_not_hardcode_docker_socket
Browse files Browse the repository at this point in the history
  • Loading branch information
6543 authored Feb 8, 2022
2 parents 71aa99b + f16525f commit a3125a0
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
5 changes: 5 additions & 0 deletions cmd/server/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions cmd/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
5 changes: 5 additions & 0 deletions docs/docs/30-administration/10-server-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ Enable to allow user registration.
Link to documentation in the UI.

### `WOODPECKER_AUTHENTICATE_PUBLIC_REPOS`
> Default: `false`
Always use authentication to clone repositories even if they are public. Needed if the SCM requires to always authenticate as used by many companies.

### `WOODPECKER_SESSION_EXPIRES`
> Default: `72h`
Expand Down
9 changes: 5 additions & 4 deletions server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ var Config = struct {
AuthToken string
}
Pipeline struct {
Limits model.ResourceLimit
Volumes []string
Networks []string
Privileged []string
AuthenticatePublicRepos bool
Limits model.ResourceLimit
Volumes []string
Networks []string
Privileged []string
}
FlatPermissions bool // TODO(485) temporary workaround to not hit api rate limits
}{}
2 changes: 1 addition & 1 deletion server/shared/procBuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ func (b *ProcBuilder) toInternalRepresentation(parsed *yaml.Config, environ map[
b.Netrc.Password,
b.Netrc.Machine,
),
b.Repo.IsSCMPrivate,
b.Repo.IsSCMPrivate || server.Config.Pipeline.AuthenticatePublicRepos,
),
compiler.WithRegistry(registries...),
compiler.WithSecret(secrets...),
Expand Down

0 comments on commit a3125a0

Please sign in to comment.