func getImageName(p *pkgPod.Pod, appName types.ACName) (string, error) { aim, err := p.AppImageManifest(appName.String()) if err != nil { return "", errwrap.Wrap(errors.New("problem retrieving ImageManifests from pod"), err) } imageName := aim.Name.String() if version, ok := aim.Labels.Get("version"); ok { imageName = fmt.Sprintf("%s:%s", imageName, version) } return imageName, nil }
// fillStaticAppInfo will modify the 'v1pod' in place with the information retrieved with 'pod'. // Today, these information are static and will not change during the pod's lifecycle. func fillStaticAppInfo(store *imagestore.Store, pod *pkgPod.Pod, v1pod *v1alpha.Pod) error { var errlist []error // Fill static app image info. for _, app := range v1pod.Apps { // Fill app's image info. app.Image = &v1alpha.Image{ BaseFormat: &v1alpha.ImageFormat{ // Only support appc image now. If it's a docker image, then it // will be transformed to appc before storing in the disk store. Type: v1alpha.ImageType_IMAGE_TYPE_APPC, Version: schema.AppContainerVersion.String(), }, Id: app.Image.Id, // Other information are not available because they require the image // info from store. Some of it is filled in below if possible. } im, err := pod.AppImageManifest(app.Name) if err != nil { stderr.PrintE(fmt.Sprintf("failed to get image manifests for app %q", app.Name), err) errlist = append(errlist, err) } else { app.Image.Name = im.Name.String() version, ok := im.Labels.Get("version") if !ok { version = "latest" } app.Image.Version = version } } if len(errlist) != 0 { return errs{errlist} } return nil }