本文整理匯總了Golang中github.com/litl/galaxy/runtime.ServiceRuntime.PullImage方法的典型用法代碼示例。如果您正苦於以下問題:Golang ServiceRuntime.PullImage方法的具體用法?Golang ServiceRuntime.PullImage怎麽用?Golang ServiceRuntime.PullImage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/litl/galaxy/runtime.ServiceRuntime
的用法示例。
在下文中一共展示了ServiceRuntime.PullImage方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: AppDeploy
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
}