Skip to content

Commit

Permalink
fix the bug that cannot be added to the image layer (#452)
Browse files Browse the repository at this point in the history
* the image cache is added to the cluster image layer and the cleaning
* fix the bug that cannot be added to the image layer
  • Loading branch information
lllwan authored Jul 24, 2021
1 parent 269098b commit ec7f30a
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions build/lite_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"fmt"
"path/filepath"

"github.com/alibaba/sealer/image"
"github.com/alibaba/sealer/utils/mount"

manifest "github.com/alibaba/sealer/build/lite/manifests"
Expand Down Expand Up @@ -144,20 +145,30 @@ func (l *LiteBuilder) MountImage() error {
}

func (l *LiteBuilder) AddUpperLayerToImage() error {
var (
err error
Image *v1.Image
)
m := filepath.Join(common.DefaultClusterBaseDir(l.local.Cluster.Name), "mount")
err := mount.NewMountDriver().Unmount(m)
err = mount.NewMountDriver().Unmount(m)
if err != nil {
return err
}
upper := filepath.Join(m, "upper")
imageLayer := v1.Layer{
Type: "BASE",
Value: "",
Value: "registry cache",
}
err = l.local.calculateLayerDigestAndPlaceIt(&imageLayer, upper)
if err != nil {
return err
}
Image, err = image.GetImageByName(l.local.Config.ImageName)
if err != nil {
return err
}
Image.Spec.Layers = append(Image.Spec.Layers, imageLayer)
l.local.Image = Image
err = l.local.updateImageIDAndSaveImage()
if err != nil {
return err
Expand Down

0 comments on commit ec7f30a

Please sign in to comment.