merged plugin changes from master to exp

This commit is contained in:
Brad Rydzewski
2014-10-11 15:35:25 -07:00
parent c283fcae20
commit ea05ec725a
8 changed files with 47 additions and 35 deletions

View File

@@ -244,6 +244,8 @@ func (b *Builder) setup() error {
if err := b.dockerClient.Images.Pull(b.Build.Image); err != nil {
return err
}
} else if err != nil {
log.Errf("failed to inspect image %s", b.Build.Image)
}
// create the Docker image
@@ -439,7 +441,7 @@ func (b *Builder) writeDockerfile(dir string) error {
switch {
case strings.HasPrefix(b.Build.Image, "bradrydzewski/"),
strings.HasPrefix(b.Build.Image, "drone/"):
// the default user for all official Drone imnage
// the default user for all official Drone image
// is the "ubuntu" user, since all build images
// inherit from the ubuntu cloud ISO
dockerfile.WriteUser("ubuntu")

View File

@@ -570,7 +570,7 @@ func TestWriteBuildScript(t *testing.T) {
f.WriteEnv("CI_BRANCH", "master")
f.WriteEnv("CI_PULL_REQUEST", "123")
f.WriteHost("127.0.0.1")
f.WriteCmd("git clone --depth=0 --recursive --branch=master git://github.com/drone/drone.git /var/cache/drone/github.com/drone/drone")
f.WriteCmd("git clone --depth=0 --recursive git://github.com/drone/drone.git /var/cache/drone/github.com/drone/drone")
f.WriteCmd("git fetch origin +refs/pull/123/head:refs/remotes/origin/pr/123")
f.WriteCmd("git checkout -qf -b pr/123 origin/pr/123")

View File

@@ -193,7 +193,7 @@ var builders = map[string]*image{
"gcc4.8": {Tag: "bradrydzewski/gcc:4.8"},
// Golang build images
"go": {Tag: "bradrydzewski/go:1.2"},
"go": {Tag: "bradrydzewski/go:1.3"},
"go1": {Tag: "bradrydzewski/go:1.0"},
"go1.1": {Tag: "bradrydzewski/go:1.1"},
"go1.2": {Tag: "bradrydzewski/go:1.2"},

View File

@@ -103,21 +103,18 @@ func (r *Repo) Commands() []string {
}
cmds := []string{}
cmds = append(cmds, fmt.Sprintf("git clone --depth=%d --recursive --branch=%s %s %s", r.Depth, branch, r.Path, r.Dir))
switch {
// if a specific commit is provided then we'll
// need to clone it.
case len(r.PR) > 0:
if len(r.PR) > 0 {
// If a specific PR is provided then we need to clone it.
cmds = append(cmds, fmt.Sprintf("git clone --depth=%d --recursive %s %s", r.Depth, r.Path, r.Dir))
cmds = append(cmds, fmt.Sprintf("git fetch origin +refs/pull/%s/head:refs/remotes/origin/pr/%s", r.PR, r.PR))
cmds = append(cmds, fmt.Sprintf("git checkout -qf -b pr/%s origin/pr/%s", r.PR, r.PR))
//cmds = append(cmds, fmt.Sprintf("git fetch origin +refs/pull/%s/merge:", r.PR))
//cmds = append(cmds, fmt.Sprintf("git checkout -qf %s", "FETCH_HEAD"))
// if a specific commit is provided then we'll
// need to clone it.
case len(r.Commit) > 0:
cmds = append(cmds, fmt.Sprintf("git checkout -qf %s", r.Commit))
} else {
// Otherwise just clone the branch.
cmds = append(cmds, fmt.Sprintf("git clone --depth=%d --recursive --branch=%s %s %s", r.Depth, branch, r.Path, r.Dir))
// If a specific commit is provided then we'll need to check it out.
if len(r.Commit) > 0 {
cmds = append(cmds, fmt.Sprintf("git checkout -qf %s", r.Commit))
}
}
return cmds