pull: de-pointer non-optional platform field
Signed-off-by: Erik Sipsma <erik@sipsma.dev>v0.8
parent
cdcf49fd18
commit
926ca1804c
|
@ -113,7 +113,7 @@ func (is *Source) Resolve(ctx context.Context, id source.Identifier, sm *session
|
|||
|
||||
pullerUtil := &pull.Puller{
|
||||
ContentStore: is.ContentStore,
|
||||
Platform: &platform,
|
||||
Platform: platform,
|
||||
Src: imageIdentifier.Reference,
|
||||
}
|
||||
p := &puller{
|
||||
|
@ -150,22 +150,18 @@ type puller struct {
|
|||
*pull.Puller
|
||||
}
|
||||
|
||||
func mainManifestKey(ctx context.Context, desc specs.Descriptor, platform *specs.Platform) (digest.Digest, error) {
|
||||
keyStruct := struct {
|
||||
func mainManifestKey(ctx context.Context, desc specs.Descriptor, platform specs.Platform) (digest.Digest, error) {
|
||||
dt, err := json.Marshal(struct {
|
||||
Digest digest.Digest
|
||||
OS string
|
||||
Arch string
|
||||
Variant string `json:",omitempty"`
|
||||
}{
|
||||
Digest: desc.Digest,
|
||||
}
|
||||
if platform != nil {
|
||||
keyStruct.OS = platform.OS
|
||||
keyStruct.Arch = platform.Architecture
|
||||
keyStruct.Variant = platform.Variant
|
||||
}
|
||||
|
||||
dt, err := json.Marshal(keyStruct)
|
||||
Digest: desc.Digest,
|
||||
OS: platform.OS,
|
||||
Arch: platform.Architecture,
|
||||
Variant: platform.Variant,
|
||||
})
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
@ -312,7 +308,7 @@ func (p *puller) Snapshot(ctx context.Context, g session.Group) (ir cache.Immuta
|
|||
}
|
||||
}
|
||||
|
||||
if current != nil && p.Platform != nil && p.Platform.OS == "windows" && runtime.GOOS != "windows" {
|
||||
if current != nil && p.Platform.OS == "windows" && runtime.GOOS != "windows" {
|
||||
if err := markRefLayerTypeWindows(current); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ type Puller struct {
|
|||
ContentStore content.Store
|
||||
Resolver remotes.Resolver
|
||||
Src reference.Spec
|
||||
Platform *ocispec.Platform
|
||||
Platform ocispec.Platform
|
||||
|
||||
resolveOnce sync.Once
|
||||
resolveErr error
|
||||
|
@ -99,12 +99,7 @@ func (p *Puller) PullManifests(ctx context.Context) (*PulledManifests, error) {
|
|||
// workaround for gcr, authentication not supported on blob endpoints
|
||||
EnsureManifestRequested(ctx, p.Resolver, p.ref)
|
||||
|
||||
var platform platforms.MatchComparer
|
||||
if p.Platform != nil {
|
||||
platform = platforms.Only(*p.Platform)
|
||||
} else {
|
||||
platform = platforms.Default()
|
||||
}
|
||||
platform := platforms.Only(p.Platform)
|
||||
|
||||
var mu sync.Mutex // images.Dispatch calls handlers in parallel
|
||||
metadata := make(map[digest.Digest]ocispec.Descriptor)
|
||||
|
|
Loading…
Reference in New Issue