Merge pull request #131 from vito/privileged-builds

Privileged builds support
This commit is contained in:
Brad Rydzewski 2014-03-19 13:21:14 -07:00
commit b1cbc21b2c
3 changed files with 17 additions and 1 deletions

View file

@ -31,6 +31,9 @@ var (
// this will default to 500 minutes (6 hours) // this will default to 500 minutes (6 hours)
timeout = flag.Duration("timeout", 300*time.Minute, "") 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 // runs Drone with verbose output if True
verbose = flag.Bool("v", false, "") verbose = flag.Bool("v", false, "")
@ -187,6 +190,7 @@ func run(path string) {
builder.Key = key builder.Key = key
builder.Stdout = os.Stdout builder.Stdout = os.Stdout
builder.Timeout = *timeout builder.Timeout = *timeout
builder.Privileged = *privileged
if *parallel == true { if *parallel == true {
var buf bytes.Buffer var buf bytes.Buffer
@ -285,6 +289,7 @@ The commands are:
-h display this help and exit -h display this help and exit
--parallel runs drone build tasks in parallel --parallel runs drone build tasks in parallel
--timeout=300ms timeout build after 300 milliseconds --timeout=300ms timeout build after 300 milliseconds
--privileged runs drone build in a privileged container
Examples: Examples:
drone build builds the source in the pwd drone build builds the source in the pwd

View file

@ -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.Disabled = len(r.FormValue("Disabled")) == 0
repo.DisabledPullRequest = len(r.FormValue("DisabledPullRequest")) == 0 repo.DisabledPullRequest = len(r.FormValue("DisabledPullRequest")) == 0
repo.Privileged = u.Admin && len(r.FormValue("Privileged")) > 0
// value of "" indicates the currently authenticated user // value of "" indicates the currently authenticated user
// should be set as the administrator. // should be set as the administrator.
if len(r.FormValue("Owner")) == 0 { if len(r.FormValue("Owner")) == 0 {

View file

@ -43,6 +43,15 @@
Enable Pull Hooks Enable Pull Hooks
</label> </label>
</div> </div>
{{ if .User.Admin }}
<div class="alert alert-min">Admin-only settings.</div>
<div class="checkbox form-group">
<label>
<input class="" type="checkbox" name="Privileged" {{ if .Repo.Privileged }}checked="True" {{ end }}/>
Enable Privileged Builds
</label>
</div>
{{ end }}
<div class="alert alert-min">Choose the account owner.</div> <div class="alert alert-min">Choose the account owner.</div>
<div> <div>
<ul class="account-radio-group"> <ul class="account-radio-group">