Skip to content

Commit

Permalink
move clone path calc due to panic
Browse files Browse the repository at this point in the history
  • Loading branch information
bradrydzewski committed Aug 19, 2015
1 parent 1947657 commit 164c0c6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
11 changes: 1 addition & 10 deletions cmd/drone-build/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ 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)
client.Destroy()
os.Exit(1)
return
}
createClone(ctx)

var execs []execFunc
if *clone {
Expand Down Expand Up @@ -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) {
Expand Down
10 changes: 9 additions & 1 deletion cmd/drone-build/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 164c0c6

Please sign in to comment.