func AppDeploy(configStore *config.Store, serviceRuntime *runtime.ServiceRuntime, app, env, version string) error { log.Printf("Pulling image %s...", version) image, err := serviceRuntime.PullImage(version, "") if image == nil || err != nil { return fmt.Errorf("unable to pull %s. Has it been released yet?", version) } svcCfg, err := configStore.GetApp(app, env) if err != nil { return fmt.Errorf("unable to deploy app: %s.", err) } if svcCfg == nil { return fmt.Errorf("app %s does not exist. Create it first.", app) } svcCfg.SetVersion(version) svcCfg.SetVersionID(utils.StripSHA(image.ID)) updated, err := configStore.UpdateApp(svcCfg, env) if err != nil { return fmt.Errorf("could not store version: %s", err) } if !updated { return fmt.Errorf("%s NOT deployed.", version) } log.Printf("Deployed %s.\n", version) return nil }