fixed compile issues with builder
This commit is contained in:
parent
64f8294775
commit
c2755f5c00
3 changed files with 16 additions and 16 deletions
|
@ -118,10 +118,10 @@ func createClone(c *Context) error {
|
||||||
|
|
||||||
c.Clone.Origin = c.Repo.Clone
|
c.Clone.Origin = c.Repo.Clone
|
||||||
c.Clone.Remote = c.Repo.Clone
|
c.Clone.Remote = c.Repo.Clone
|
||||||
c.Clone.Sha = c.Commit.Sha
|
c.Clone.Sha = c.Build.Commit.Sha
|
||||||
c.Clone.Ref = c.Commit.Ref
|
c.Clone.Ref = c.Build.Commit.Ref
|
||||||
c.Clone.Branch = c.Commit.Branch
|
c.Clone.Branch = c.Build.Commit.Branch
|
||||||
// TODO move this to the main app (github package)
|
// TODO do we still need this? it should be set by the remote
|
||||||
if strings.HasPrefix(c.Clone.Branch, "refs/heads/") {
|
if strings.HasPrefix(c.Clone.Branch, "refs/heads/") {
|
||||||
c.Clone.Branch = c.Clone.Branch[11:]
|
c.Clone.Branch = c.Clone.Branch[11:]
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ type Context struct {
|
||||||
// Links *common.Link
|
// Links *common.Link
|
||||||
Clone *common.Clone `json:"clone"`
|
Clone *common.Clone `json:"clone"`
|
||||||
Repo *common.Repo `json:"repo"`
|
Repo *common.Repo `json:"repo"`
|
||||||
Commit *common.Commit `json:"commit"`
|
Build *common.Build `json:"build"`
|
||||||
Job *common.Job `json:"job"`
|
Job *common.Job `json:"job"`
|
||||||
Keys *common.Keypair `json:"keys"`
|
Keys *common.Keypair `json:"keys"`
|
||||||
Netrc *common.Netrc `json:"netrc"`
|
Netrc *common.Netrc `json:"netrc"`
|
||||||
|
|
|
@ -6,12 +6,12 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/drone/drone/Godeps/_workspace/src/github.com/samalba/dockerclient"
|
"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
|
// helper function that converts the build step to
|
||||||
// a containerConfig for use with the dockerclient
|
// a containerConfig for use with the dockerclient
|
||||||
func toContainerConfig(step *common.Step) *dockerclient.ContainerConfig {
|
func toContainerConfig(step *types.Step) *dockerclient.ContainerConfig {
|
||||||
config := &dockerclient.ContainerConfig{
|
config := &dockerclient.ContainerConfig{
|
||||||
Image: step.Image,
|
Image: step.Image,
|
||||||
Env: step.Environment,
|
Env: step.Environment,
|
||||||
|
@ -47,8 +47,8 @@ func toEnv(c *Context) map[string]string {
|
||||||
return map[string]string{
|
return map[string]string{
|
||||||
"CI": "true",
|
"CI": "true",
|
||||||
"BUILD_DIR": c.Clone.Dir,
|
"BUILD_DIR": c.Clone.Dir,
|
||||||
"BUILD_ID": strconv.Itoa(c.Commit.Sequence),
|
"BUILD_ID": strconv.Itoa(c.Build.Number),
|
||||||
"BUILD_NUMBER": strconv.Itoa(c.Commit.Sequence),
|
"BUILD_NUMBER": strconv.Itoa(c.Build.Number),
|
||||||
"JOB_NAME": c.Repo.FullName,
|
"JOB_NAME": c.Repo.FullName,
|
||||||
"WORKSPACE": c.Clone.Dir,
|
"WORKSPACE": c.Clone.Dir,
|
||||||
"GIT_BRANCH": c.Clone.Branch,
|
"GIT_BRANCH": c.Clone.Branch,
|
||||||
|
@ -56,7 +56,7 @@ func toEnv(c *Context) map[string]string {
|
||||||
|
|
||||||
"DRONE": "true",
|
"DRONE": "true",
|
||||||
"DRONE_REPO": c.Repo.FullName,
|
"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_BRANCH": c.Clone.Branch,
|
||||||
"DRONE_COMMIT": c.Clone.Sha,
|
"DRONE_COMMIT": c.Clone.Sha,
|
||||||
"DRONE_DIR": c.Clone.Dir,
|
"DRONE_DIR": c.Clone.Dir,
|
||||||
|
@ -66,10 +66,10 @@ func toEnv(c *Context) map[string]string {
|
||||||
// helper function to encode the build step to
|
// helper function to encode the build step to
|
||||||
// a json string. Primarily used for plugins, which
|
// a json string. Primarily used for plugins, which
|
||||||
// expect a json encoded string in stdin or arg[1].
|
// 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{
|
p := payload{
|
||||||
c.Repo,
|
c.Repo,
|
||||||
c.Commit,
|
c.Build,
|
||||||
c.Job,
|
c.Job,
|
||||||
c.Clone,
|
c.Clone,
|
||||||
step.Config,
|
step.Config,
|
||||||
|
@ -81,10 +81,10 @@ func toCommand(c *Context, step *common.Step) []string {
|
||||||
// that is serialized and sent to the plugin in JSON
|
// that is serialized and sent to the plugin in JSON
|
||||||
// format via stdin or arg[1].
|
// format via stdin or arg[1].
|
||||||
type payload struct {
|
type payload struct {
|
||||||
Repo *common.Repo `json:"repo"`
|
Repo *types.Repo `json:"repo"`
|
||||||
Commit *common.Commit `json:"commit"`
|
Build *types.Build `json:"build"`
|
||||||
Job *common.Job `json:"job"`
|
Job *types.Job `json:"job"`
|
||||||
Clone *common.Clone `json:"clone"`
|
Clone *types.Clone `json:"clone"`
|
||||||
|
|
||||||
Config map[string]interface{} `json:"vargs"`
|
Config map[string]interface{} `json:"vargs"`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue