Skip to content

Commit

Permalink
fix(kk): handle the duplicate image name which in the kk artifact
Browse files Browse the repository at this point in the history
Signed-off-by: 24sama <[email protected]>
  • Loading branch information
24sama committed Dec 19, 2022
1 parent 3cc0ebe commit f90d6b3
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions cmd/kk/pkg/images/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"fmt"
"io/ioutil"
"path/filepath"
"reflect"
"strings"

manifestregistry "github.com/estesp/manifest-tool/v2/pkg/registry"
Expand Down Expand Up @@ -260,9 +261,21 @@ func (c *CopyImagesToRegistry) Execute(runtime connector.Runtime) error {
Image: image.ImageName(),
Platform: p,
}

skip := false
if v, ok := manifestList[uniqueImage]; ok {
v = append(v, entry)
manifestList[uniqueImage] = v
// skip if the image already copied
for _, old := range v {
if reflect.DeepEqual(old, entry) {
skip = true
break
}
}

if !skip {
v = append(v, entry)
manifestList[uniqueImage] = v
}
} else {
entryArr := make([]manifesttypes.ManifestEntry, 0)
manifestList[uniqueImage] = append(entryArr, entry)
Expand Down

0 comments on commit f90d6b3

Please sign in to comment.