diff --git a/cmd/drone/drone.go b/cmd/drone/drone.go index 91408f2bc..ea5d98652 100644 --- a/cmd/drone/drone.go +++ b/cmd/drone/drone.go @@ -31,6 +31,9 @@ var ( // this will default to 500 minutes (6 hours) timeout = flag.Duration("timeout", 300*time.Minute, "") + // build will run in a privileged container + privileged = flag.Bool("privileged", false, "") + // runs Drone with verbose output if True verbose = flag.Bool("v", false, "") @@ -187,6 +190,7 @@ func run(path string) { builder.Key = key builder.Stdout = os.Stdout builder.Timeout = *timeout + builder.Privileged = *privileged if *parallel == true { var buf bytes.Buffer @@ -285,6 +289,7 @@ The commands are: -h display this help and exit --parallel runs drone build tasks in parallel --timeout=300ms timeout build after 300 milliseconds + --privileged runs drone build in a privileged container Examples: drone build builds the source in the pwd diff --git a/pkg/handler/repos.go b/pkg/handler/repos.go index de232b8e5..36b15ed47 100644 --- a/pkg/handler/repos.go +++ b/pkg/handler/repos.go @@ -229,6 +229,8 @@ func RepoUpdate(w http.ResponseWriter, r *http.Request, u *User, repo *Repo) err repo.Disabled = len(r.FormValue("Disabled")) == 0 repo.DisabledPullRequest = len(r.FormValue("DisabledPullRequest")) == 0 + repo.Privileged = u.Admin && len(r.FormValue("Privileged")) > 0 + // value of "" indicates the currently authenticated user // should be set as the administrator. if len(r.FormValue("Owner")) == 0 { diff --git a/pkg/template/pages/repo_settings.html b/pkg/template/pages/repo_settings.html index 7d54bbd34..8d92fe698 100644 --- a/pkg/template/pages/repo_settings.html +++ b/pkg/template/pages/repo_settings.html @@ -43,6 +43,15 @@ Enable Pull Hooks + {{ if .User.Admin }} +