Skip to content

Commit

Permalink
fix: add check for the optional ref.Platform field to avoid nil point…
Browse files Browse the repository at this point in the history
…er in TagInfoFromReferences (argoproj-labs#759)

Signed-off-by: Cheng Fang <[email protected]>
  • Loading branch information
chengfang authored and sribiere-jellysmack committed Aug 13, 2024
1 parent 55899e0 commit 30263e0
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions pkg/registry/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,12 +361,18 @@ func TagInfoFromReferences(client *registryClient, opts *options.ManifestOptions
platforms := []string{}

for _, ref := range references {
platforms = append(platforms, ref.Platform.OS+"/"+ref.Platform.Architecture)
logCtx.Tracef("Found %s", options.PlatformKey(ref.Platform.OS, ref.Platform.Architecture, ref.Platform.Variant))
if !opts.WantsPlatform(ref.Platform.OS, ref.Platform.Architecture, ref.Platform.Variant) {
var refOS, refArch, refVariant string
if ref.Platform != nil {
refOS = ref.Platform.OS
refArch = ref.Platform.Architecture
refVariant = ref.Platform.Variant
}
platforms = append(platforms, refOS+"/"+refArch)
logCtx.Tracef("Found %s", options.PlatformKey(refOS, refArch, refVariant))
if !opts.WantsPlatform(refOS, refArch, refVariant) {
logCtx.Tracef("Ignoring referenced manifest %v because platform %s does not match any of: %s",
ref.Digest,
options.PlatformKey(ref.Platform.OS, ref.Platform.Architecture, ref.Platform.Variant),
options.PlatformKey(refOS, refArch, refVariant),
strings.Join(opts.Platforms(), ","))
continue
}
Expand Down

0 comments on commit 30263e0

Please sign in to comment.