From 164c0c6a8e6cc6ea8a763ea9376c1d1c720e1856 Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Wed, 19 Aug 2015 12:38:08 -0700 Subject: [PATCH] move clone path calc due to panic --- Makefile | 3 +++ cmd/drone-build/main.go | 11 +---------- cmd/drone-build/run.go | 10 +++++++++- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index f54edc7ad..3536db25e 100644 --- a/Makefile +++ b/Makefile @@ -45,6 +45,9 @@ bindata: bindata_debug: $$GOPATH/bin/go-bindata --debug -o="cmd/drone-server/drone_bindata.go" cmd/drone-server/static/... +docker: + docker build --file=cmd/drone-build/Dockerfile.alpine --rm=true -t drone/drone-build . + # creates a debian package for drone # to install `sudo dpkg -i drone.deb` dist: diff --git a/cmd/drone-build/main.go b/cmd/drone-build/main.go index 11c6dc198..71a0af5f6 100644 --- a/cmd/drone-build/main.go +++ b/cmd/drone-build/main.go @@ -58,6 +58,7 @@ func main() { // performs some initial parsing and pre-processing steps // prior to executing our build tasks. + createClone(ctx) err = setup(ctx) if err != nil { log.Errorln("Error processing .drone.yml file.", err) @@ -65,7 +66,6 @@ func main() { os.Exit(1) return } - createClone(ctx) var execs []execFunc if *clone { @@ -128,15 +128,6 @@ func createClone(c *Context) error { // to the clone object for merge requests from bitbucket, gitlab, et al // if len(c.Commit.PullRequest) != 0 { // } - pathv, ok := c.Conf.Clone.Config["path"] - if ok { - path, ok := pathv.(string) - if ok { - c.Clone.Dir = path - return nil - } - } - return fmt.Errorf("Workspace path not found") } func parseContext() (*Context, error) { diff --git a/cmd/drone-build/run.go b/cmd/drone-build/run.go index a87ca9132..7a9611f82 100644 --- a/cmd/drone-build/run.go +++ b/cmd/drone-build/run.go @@ -62,7 +62,15 @@ func setup(c *Context) error { c.Conf.Build.Environment = append(c.Conf.Build.Environment, env) } - return nil + pathv, ok := c.Conf.Clone.Config["path"] + if ok { + path, ok := pathv.(string) + if ok { + c.Clone.Dir = path + return nil + } + } + return fmt.Errorf("Workspace path not found") } type execFunc func(c *Context) (int, error)