Skip to content

Commit

Permalink
Fix: use run image "image" instead of "reference" to get remote image…
Browse files Browse the repository at this point in the history
… metadata

If we're using a daemon the reference will be a daemon image ID which is not helpful

Signed-off-by: Natalie Arellano <narellano@vmware.com>
  • Loading branch information
natalieparellano committed Jun 30, 2023
1 parent debf8de commit 9434a2d
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions cmd/lifecycle/restorer.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,22 +101,18 @@ func (r *restoreCmd) Exec() error {
var (
remoteRunImage imgutil.Image
)
runImageName := analyzedMD.RunImageImage() // FIXME: if we have a digest reference available in `Reference` (e.g., in the non-daemon case) we should use it
if r.supportsRunImageExtension() && needsPulling(analyzedMD.RunImage) {
runImageRef := analyzedMD.RunImageImage() // FIXME: if we have a digest reference available in `Reference` (e.g., in the non-daemon case) we should use it
if runImageRef == "" {
// Platform API 0.12 and above always populates this field
return cmd.FailErr(err, "get run image reference from analyzed.toml")
}
cmd.DefaultLogger.Debugf("Pulling run image metadata for %s...", runImageRef)
remoteRunImage, err = r.pullSparse(runImageRef)
cmd.DefaultLogger.Debugf("Pulling run image metadata for %s...", runImageName)
remoteRunImage, err = r.pullSparse(runImageName)
if err != nil {
return cmd.FailErr(err, "pull run image")
}
}
if r.supportsTargetData() && needsUpdating(analyzedMD.RunImage) {
cmd.DefaultLogger.Debugf("Updating run image info in analyzed metadata...")
if remoteRunImage == nil { // we didn't pull the run image in the previous step
remoteRunImage, err = remote.NewImage(analyzedMD.RunImage.Reference, r.keychain)
remoteRunImage, err = remote.NewImage(runImageName, r.keychain)
if err != nil {
return cmd.FailErr(err, "read run image")
}
Expand Down

0 comments on commit 9434a2d

Please sign in to comment.