diff --git a/cmd/drone-build/main.go b/cmd/drone-build/main.go index 8f7129a3..758ddbcc 100644 --- a/cmd/drone-build/main.go +++ b/cmd/drone-build/main.go @@ -118,10 +118,10 @@ func createClone(c *Context) error { c.Clone.Origin = c.Repo.Clone c.Clone.Remote = c.Repo.Clone - c.Clone.Sha = c.Commit.Sha - c.Clone.Ref = c.Commit.Ref - c.Clone.Branch = c.Commit.Branch - // TODO move this to the main app (github package) + c.Clone.Sha = c.Build.Commit.Sha + c.Clone.Ref = c.Build.Commit.Ref + c.Clone.Branch = c.Build.Commit.Branch + // TODO do we still need this? it should be set by the remote if strings.HasPrefix(c.Clone.Branch, "refs/heads/") { c.Clone.Branch = c.Clone.Branch[11:] } diff --git a/cmd/drone-build/run.go b/cmd/drone-build/run.go index 2d499229..ca67c4e7 100644 --- a/cmd/drone-build/run.go +++ b/cmd/drone-build/run.go @@ -13,7 +13,7 @@ type Context struct { // Links *common.Link Clone *common.Clone `json:"clone"` Repo *common.Repo `json:"repo"` - Commit *common.Commit `json:"commit"` + Build *common.Build `json:"build"` Job *common.Job `json:"job"` Keys *common.Keypair `json:"keys"` Netrc *common.Netrc `json:"netrc"` diff --git a/cmd/drone-build/util.go b/cmd/drone-build/util.go index 8cb69293..daeb68d3 100644 --- a/cmd/drone-build/util.go +++ b/cmd/drone-build/util.go @@ -6,12 +6,12 @@ import ( "strings" "github.com/drone/drone/Godeps/_workspace/src/github.com/samalba/dockerclient" - common "github.com/drone/drone/pkg/types" + "github.com/drone/drone/pkg/types" ) // helper function that converts the build step to // a containerConfig for use with the dockerclient -func toContainerConfig(step *common.Step) *dockerclient.ContainerConfig { +func toContainerConfig(step *types.Step) *dockerclient.ContainerConfig { config := &dockerclient.ContainerConfig{ Image: step.Image, Env: step.Environment, @@ -47,8 +47,8 @@ func toEnv(c *Context) map[string]string { return map[string]string{ "CI": "true", "BUILD_DIR": c.Clone.Dir, - "BUILD_ID": strconv.Itoa(c.Commit.Sequence), - "BUILD_NUMBER": strconv.Itoa(c.Commit.Sequence), + "BUILD_ID": strconv.Itoa(c.Build.Number), + "BUILD_NUMBER": strconv.Itoa(c.Build.Number), "JOB_NAME": c.Repo.FullName, "WORKSPACE": c.Clone.Dir, "GIT_BRANCH": c.Clone.Branch, @@ -56,7 +56,7 @@ func toEnv(c *Context) map[string]string { "DRONE": "true", "DRONE_REPO": c.Repo.FullName, - "DRONE_BUILD": strconv.Itoa(c.Commit.Sequence), + "DRONE_BUILD": strconv.Itoa(c.Build.Number), "DRONE_BRANCH": c.Clone.Branch, "DRONE_COMMIT": c.Clone.Sha, "DRONE_DIR": c.Clone.Dir, @@ -66,10 +66,10 @@ func toEnv(c *Context) map[string]string { // helper function to encode the build step to // a json string. Primarily used for plugins, which // expect a json encoded string in stdin or arg[1]. -func toCommand(c *Context, step *common.Step) []string { +func toCommand(c *Context, step *types.Step) []string { p := payload{ c.Repo, - c.Commit, + c.Build, c.Job, c.Clone, step.Config, @@ -81,10 +81,10 @@ func toCommand(c *Context, step *common.Step) []string { // that is serialized and sent to the plugin in JSON // format via stdin or arg[1]. type payload struct { - Repo *common.Repo `json:"repo"` - Commit *common.Commit `json:"commit"` - Job *common.Job `json:"job"` - Clone *common.Clone `json:"clone"` + Repo *types.Repo `json:"repo"` + Build *types.Build `json:"build"` + Job *types.Job `json:"job"` + Clone *types.Clone `json:"clone"` Config map[string]interface{} `json:"vargs"` }