Skip to content

Commit

Permalink
Fixed docker update pull race condition
Browse files Browse the repository at this point in the history
* Prior would attempt to pull the existing image.
* Changed to pull the new version
  • Loading branch information
dcwangmit01 committed Sep 24, 2018
1 parent 573cfe6 commit 91e8eb0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion pkg/kdk/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ import (
)

func Pull(cfg *KdkEnvConfig) error {
out, err := cfg.DockerClient.ImagePull(cfg.Ctx, cfg.ImageCoordinates(), types.ImagePullOptions{})
return pullImage(cfg, cfg.ImageCoordinates())
}

func pullImage(cfg *KdkEnvConfig, imageCoordinates string) error {

out, err := cfg.DockerClient.ImagePull(cfg.Ctx, imageCoordinates, types.ImagePullOptions{})
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/kdk/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func Update(cfg *KdkEnvConfig) {

if needsUpdateImage(cfg) {
log.Info("Updating KDK image")
err := updateImage(cfg)
err := pullImage(cfg, cfg.ConfigFile.AppConfig.ImageRepository + ":" + latestReleaseVersion)
if err != nil {
log.WithField("error", err).Fatal("Failed to update KDK image")
}
Expand Down

0 comments on commit 91e8eb0

Please sign in to comment.