run privileged builds in web workers
This commit is contained in:
parent
6e2b74eac7
commit
3145b710c1
2 changed files with 4 additions and 2 deletions
|
@ -11,7 +11,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type BuildRunner interface {
|
type BuildRunner interface {
|
||||||
Run(buildScript *script.Build, repo *repo.Repo, key []byte, buildOutput io.Writer) (success bool, err error)
|
Run(buildScript *script.Build, repo *repo.Repo, key []byte, privileged bool, buildOutput io.Writer) (success bool, err error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type buildRunner struct {
|
type buildRunner struct {
|
||||||
|
@ -26,11 +26,12 @@ func NewBuildRunner(dockerClient *docker.Client, timeout time.Duration) BuildRun
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (runner *buildRunner) Run(buildScript *script.Build, repo *repo.Repo, key []byte, buildOutput io.Writer) (bool, error) {
|
func (runner *buildRunner) Run(buildScript *script.Build, repo *repo.Repo, key []byte, privileged bool, buildOutput io.Writer) (bool, error) {
|
||||||
builder := build.New(runner.dockerClient)
|
builder := build.New(runner.dockerClient)
|
||||||
builder.Build = buildScript
|
builder.Build = buildScript
|
||||||
builder.Repo = repo
|
builder.Repo = repo
|
||||||
builder.Key = key
|
builder.Key = key
|
||||||
|
builder.Privileged = privileged
|
||||||
builder.Stdout = buildOutput
|
builder.Stdout = buildOutput
|
||||||
builder.Timeout = runner.timeout
|
builder.Timeout = runner.timeout
|
||||||
|
|
||||||
|
|
|
@ -183,6 +183,7 @@ func (w *worker) runBuild(task *BuildTask, buf io.Writer) (bool, error) {
|
||||||
task.Script,
|
task.Script,
|
||||||
repo,
|
repo,
|
||||||
[]byte(task.Repo.PrivateKey),
|
[]byte(task.Repo.PrivateKey),
|
||||||
|
task.Repo.Privileged,
|
||||||
buf,
|
buf,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue