mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-26 11:51:02 +00:00
ability to pass --deploy and --publish flags to drone build
This commit is contained in:
parent
643f811f05
commit
afc3030087
1 changed files with 20 additions and 7 deletions
27
cli/build.go
27
cli/build.go
|
@ -34,6 +34,16 @@ func NewBuildCommand() cli.Command {
|
|||
Value: "false",
|
||||
Usage: "runs drone build in a privileged container",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "deploy",
|
||||
Value: "false",
|
||||
Usage: "runs drone build with deployments enabled",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "publish",
|
||||
Value: "false",
|
||||
Usage: "runs drone build with publishing enabled",
|
||||
},
|
||||
},
|
||||
Action: func(c *cli.Context) {
|
||||
buildCommandFunc(c)
|
||||
|
@ -45,6 +55,8 @@ func NewBuildCommand() cli.Command {
|
|||
func buildCommandFunc(c *cli.Context) {
|
||||
var privileged = c.Bool("p")
|
||||
var identity = c.String("i")
|
||||
var deploy = c.Bool("deploy")
|
||||
var publish = c.Bool("publish")
|
||||
var path string
|
||||
|
||||
// the path is provided as an optional argument that
|
||||
|
@ -71,11 +83,11 @@ func buildCommandFunc(c *cli.Context) {
|
|||
log.SetPriority(log.LOG_DEBUG) //LOG_NOTICE
|
||||
docker.Logging = false
|
||||
|
||||
var exit, _ = run(path, identity, privileged)
|
||||
var exit, _ = run(path, identity, publish, deploy, privileged)
|
||||
os.Exit(exit)
|
||||
}
|
||||
|
||||
func run(path, identity string, privileged bool) (int, error) {
|
||||
func run(path, identity string, publish, deploy, privileged bool) (int, error) {
|
||||
dockerClient := docker.New()
|
||||
|
||||
// parse the private environment variables
|
||||
|
@ -93,10 +105,12 @@ func run(path, identity string, privileged bool) (int, error) {
|
|||
s.Env = append(s.Env, key+"="+val)
|
||||
}
|
||||
|
||||
// remove deploy & publish sections
|
||||
// for now, until I fix bug
|
||||
s.Publish = nil
|
||||
s.Deploy = nil
|
||||
if deploy == false {
|
||||
s.Publish = nil
|
||||
}
|
||||
if publish == false {
|
||||
s.Deploy = nil
|
||||
}
|
||||
|
||||
// get the repository root directory
|
||||
dir := filepath.Dir(path)
|
||||
|
@ -144,7 +158,6 @@ func run(path, identity string, privileged bool) (int, error) {
|
|||
builder.Repo = &code
|
||||
builder.Key = key
|
||||
builder.Stdout = os.Stdout
|
||||
// TODO ADD THIS BACK
|
||||
builder.Timeout = 300 * time.Minute
|
||||
builder.Privileged = privileged
|
||||
|
||||
|
|
Loading…
Reference in a new issue