Skip to content

Commit cd58781

Browse files
committed
fix: Get version from the BuildInfo.Main.Version if not found in deps and build flag
1 parent 48686ac commit cd58781

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

api/provenance/provenance.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,24 @@ func GetProvenance() Provenance {
6767

6868
for _, dep := range info.Deps {
6969
if dep != nil && dep.Path == "sigs.k8s.io/kustomize/kustomize/v5" {
70-
if dep.Version != "devel" {
70+
if dep.Version == developmentVersion {
7171
continue
7272
}
7373
v, err := GetMostRecentTag(*dep)
7474
if err != nil {
7575
fmt.Printf("failed to get most recent tag for %s: %v\n", dep.Path, err)
76-
continue
76+
break
7777
}
7878
p.Version = v
79+
80+
return p
7981
}
8082
}
8183

84+
if info.Main.Version != "" && p.Version == developmentVersion {
85+
p.Version = info.Main.Version
86+
}
87+
8288
return p
8389
}
8490

0 commit comments

Comments
 (0)