From 6414d4e21ec3c6e8280179e3fb3050b04ccbf6ac Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Fri, 15 May 2015 16:24:10 -0700 Subject: [PATCH] fixed some issues with container downloads --- cmd/drone-build/client.go | 2 +- cmd/drone-build/util.go | 4 ++++ runner/builtin/worker.go | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/drone-build/client.go b/cmd/drone-build/client.go index f25ac3fa4..bcce7c665 100644 --- a/cmd/drone-build/client.go +++ b/cmd/drone-build/client.go @@ -182,7 +182,7 @@ func daemon(client dockerclient.Client, conf *dockerclient.ContainerConfig, pull id, err = client.CreateContainer(conf, "") // make sure the container is removed in // the event of a creation error. - if len(id) != 0 { + if err != nil && len(id) != 0 { client.RemoveContainer(id, true, true) } if err != nil { diff --git a/cmd/drone-build/util.go b/cmd/drone-build/util.go index 459427959..ec77f3179 100644 --- a/cmd/drone-build/util.go +++ b/cmd/drone-build/util.go @@ -24,6 +24,10 @@ func toContainerConfig(step *common.Step) *dockerclient.ContainerConfig { }, } + if len(config.Entrypoint) == 0 { + config.Entrypoint = nil + } + config.Volumes = map[string]struct{}{} for _, path := range step.Volumes { if strings.Index(path, ":") == -1 { diff --git a/runner/builtin/worker.go b/runner/builtin/worker.go index 66397e9e4..ce3eddb4f 100644 --- a/runner/builtin/worker.go +++ b/runner/builtin/worker.go @@ -170,7 +170,7 @@ func run(client dockerclient.Client, conf *dockerclient.ContainerConfig, name st id, err = client.CreateContainer(conf, name) // make sure the container is removed in // the event of a creation error. - if len(id) != 0 { + if err != nil && len(id) != 0 { client.RemoveContainer(id, true, true) } if err != nil {