Skip to content

Commit

Permalink
Reinitalize Metas for every item
Browse files Browse the repository at this point in the history
  • Loading branch information
cari-lynn committed Sep 8, 2021
1 parent e2e6aa9 commit 4cd7f07
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions pkg/kbld/config/image_meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package config

import (
"encoding/json"
"fmt"

"sigs.k8s.io/yaml"
)
Expand Down Expand Up @@ -72,14 +71,15 @@ func (m *ImageMeta) UnmarshalJSON(data []byte) error {
return err
}

var local BuiltImageSourceLocal
var git BuiltImageSourceGit
var res ResolvedImageSourceURL
var preres PreresolvedImageSourceURL
var tag TaggedImageMeta

for _, item := range list {
var local BuiltImageSourceLocal
var git BuiltImageSourceGit
var res ResolvedImageSourceURL
var preres PreresolvedImageSourceURL
var tag TaggedImageMeta

yamlItem, _ := yaml.Marshal(&item)

switch {
case yaml.Unmarshal(yamlItem, &local) == nil && local.Type == "local":
m.Metas = append(m.Metas, local)
Expand All @@ -91,8 +91,6 @@ func (m *ImageMeta) UnmarshalJSON(data []byte) error {
m.Metas = append(m.Metas, preres)
case yaml.Unmarshal(yamlItem, &tag) == nil && tag.Type == "tagged":
m.Metas = append(m.Metas, tag)
default:
return fmt.Errorf("Unknown Image Meta")
}
}
return nil
Expand Down

0 comments on commit 4cd7f07

Please sign in to comment.