Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix an idempotency problem when we left cruft after a failed build #454

Merged
merged 1 commit into from
Jun 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions processors/code/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ func Setup(appModel *models.App, componentModel *models.Component, warehouseConf

// create docker container
config := container_generator.ComponentConfig(componentModel)
// remove any container that may have been created with this name befor
// this can happen if the process is killed after the
// container was created but before our db model was saved
docker.ContainerRemove(config.Name)

container, err := docker.CreateContainer(config)
if err != nil {
lumber.Error("code:Setup:createContainer:docker.CreateContainer(%+v)", config)
Expand Down
6 changes: 6 additions & 0 deletions processors/component/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ func Setup(appModel *models.App, componentModel *models.Component) error {
// start the container
display.StartTask("Starting docker container")
config := container_generator.ComponentConfig(componentModel)

// remove any container that may have been created with this name befor
// this can happen if the process is killed after the
// container was created but before our db model was saved
docker.ContainerRemove(config.Name)

container, err := docker.CreateContainer(config)
if err != nil {
lumber.Error("component:Setup:docker.CreateContainer(%+v): %s", config, err.Error())
Expand Down