Skip to content

Commit

Permalink
fixed platform not being set for scratch images
Browse files Browse the repository at this point in the history
  • Loading branch information
djcass44 committed Dec 18, 2023
1 parent e12a413 commit 83733b4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 9 additions & 0 deletions pkg/containerutil/append.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@ func (ib *Image) Append(ctx context.Context, fs fs.FullFS, platform *v1.Platform
return nil, err
}
cfg = cfg.DeepCopy()

// copy platform metadata
cfg.OS = platform.OS
cfg.Architecture = platform.Architecture
cfg.OSVersion = platform.OSVersion
cfg.Variant = platform.Variant
cfg.OSFeatures = platform.OSFeatures

// setup other config bits
cfg.Author = ib.author
cfg.Config.WorkingDir = filepath.Join("/home", ib.username)
cfg.Config.User = ib.username
Expand Down
6 changes: 3 additions & 3 deletions pkg/packages/alpine/alpine.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
var installedFile = filepath.Join("/lib", "apk", "db", "installed")

type PackageKeeper struct {
rootfs fs.FullFS
rootfs fs.FullFS
indices []apk.NamedIndex
}

Expand All @@ -39,7 +39,7 @@ func NewPackageKeeper(ctx context.Context, repositories []string, rootfs fs.Full

return &PackageKeeper{
indices: indices,
rootfs: rootfs,
rootfs: rootfs,
}, nil
}

Expand Down Expand Up @@ -74,7 +74,7 @@ func (p *PackageKeeper) Record(ctx context.Context, pkg *repository.RepositoryPa
scanner := bufio.NewScanner(bytes.NewReader(world))
for scanner.Scan() {
line := scanner.Text()
if line == "P:" + pkg.Name {
if line == "P:"+pkg.Name {
log.V(2).Info("located package in installed file")
return nil
}
Expand Down

0 comments on commit 83733b4

Please sign in to comment.