fix(kk): handle the duplicate image name which in the kk artifact

Signed-off-by: 24sama <jacksama@foxmail.com>
This commit is contained in:
24sama 2022-12-19 10:35:01 +08:00
parent 3cc0ebe23c
commit f90d6b3ca8
No known key found for this signature in database
GPG Key ID: 36E644BDB7CDC813

View File

@ -21,6 +21,7 @@ import (
"fmt"
"io/ioutil"
"path/filepath"
"reflect"
"strings"
manifestregistry "github.com/estesp/manifest-tool/v2/pkg/registry"
@ -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)