move clone path calc due to panic

This commit is contained in:
Brad Rydzewski 2015-08-19 12:38:08 -07:00
parent 1947657e25
commit 164c0c6a8e
3 changed files with 13 additions and 11 deletions

View file

@ -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:

View file

@ -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) {

View file

@ -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)