Skip to content

Commit

Permalink
fixup! fix edit set image to parse both tag and digest
Browse files Browse the repository at this point in the history
  • Loading branch information
blackjid committed Sep 27, 2023
1 parent 3d902ab commit b8015ed
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions api/pkg/util/image.go
@@ -0,0 +1,10 @@
package util

import (
"sigs.k8s.io/kustomize/api/internal/image"
)

// Splits image string name into name, tag and digest
func SplitImageName(imageName string) (name string, tag string, digest string) {
return image.Split(imageName)
}
4 changes: 2 additions & 2 deletions kustomize/commands/edit/set/setimage.go
Expand Up @@ -9,7 +9,7 @@ import (
"sort"
"strings"

"sigs.k8s.io/kustomize/api/image"
"sigs.k8s.io/kustomize/api/pkg/util"
"sigs.k8s.io/kustomize/api/types"

"github.com/spf13/cobra"
Expand Down Expand Up @@ -215,7 +215,7 @@ func parse(arg string) (types.Image, error) {
return types.Image{}, err
}

name, tag, digest := image.Split(value)
name, tag, digest := util.SplitImageName(value)
if name == arg {
return types.Image{}, errImageInvalidArgs
}
Expand Down

0 comments on commit b8015ed

Please sign in to comment.