Skip to content

Commit e95cee0

Browse files
committed
cmd/cdi: validate also Spec version.
Signed-off-by: Krisztian Litkey <[email protected]>
1 parent 7123c3b commit e95cee0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Diff for: cmd/cdi/cmd/validate.go

+10
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"github.com/spf13/cobra"
2525

2626
"tags.cncf.io/container-device-interface/pkg/cdi"
27+
"tags.cncf.io/container-device-interface/specs-go"
2728
)
2829

2930
// validateCmd is our CDI command for validating CDI Spec files in the cache.
@@ -49,6 +50,15 @@ were reported by the cache.`,
4950
fmt.Printf(" %2d: %v\n", idx, strings.TrimSpace(err.Error()))
5051
}
5152
}
53+
54+
for _, v := range cache.ListVendors() {
55+
for _, s := range cache.GetVendorSpecs(v) {
56+
if err := specs.ValidateVersion(s.Spec); err != nil {
57+
fmt.Printf("Spec file %s failed version validation: %v\n", s.GetPath(), err)
58+
}
59+
}
60+
}
61+
5262
os.Exit(1)
5363
},
5464
}

0 commit comments

Comments
 (0)