Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: use instance name as saved name #2260

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions pkg/imageengine/buildah/save.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,25 @@ func (engine *Engine) Save(opts *options.SaveOptions) error {
if err != nil {
return err
}

if len(images) == 0 {
return fmt.Errorf("no image matched with digest %s", instanceDigest)
}

instanceTar := filepath.Join(tempDir, images[0].ID+".tar")
err = engine.saveOneImage(images[0].ID, opts.Format, instanceTar, opts.Compress)
instance := images[0]
instanceTar := filepath.Join(tempDir, instance.ID+".tar")

// if instance has "Names", use the first one as saved name
instanceName := instance.ID
if len(instance.Names) > 0 {
instanceName = instance.Names[0]
}

err = engine.saveOneImage(instanceName, opts.Format, instanceTar, opts.Compress)
if err != nil {
return err
}

pathsToCompress = append(pathsToCompress, instanceTar)
}

Expand Down