Skip to content

Commit 78a78a6

Browse files
authored
feat: skip install on validate-krew-manifest (#736)
* feat: skip install on validate-krew-manifest * skip install
1 parent 1649da8 commit 78a78a6

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

cmd/validate-krew-manifest/main.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ import (
3939
)
4040

4141
var flManifest string
42+
var flSkipInstall bool
4243

4344
func init() {
4445
flag.StringVar(&flManifest, "manifest", "", "path to plugin manifest file")
46+
flag.BoolVar(&flSkipInstall, "skip-install", false, "skips installing the plugin as part of the validation")
4547
}
4648

4749
func main() {
@@ -97,15 +99,17 @@ func validateManifestFile(path string) error {
9799
}
98100
klog.Infof("no overlapping spec.platform[].selector")
99101

100-
// exercise "install" for all platforms
101-
for i, p := range p.Spec.Platforms {
102-
klog.Infof("installing spec.platform[%d]", i)
103-
if err := installPlatformSpec(path, p); err != nil {
104-
return errors.Wrapf(err, "spec.platforms[%d] failed to install", i)
102+
if !flSkipInstall {
103+
// exercise "install" for all platforms
104+
for i, p := range p.Spec.Platforms {
105+
klog.Infof("installing spec.platform[%d]", i)
106+
if err := installPlatformSpec(path, p); err != nil {
107+
return errors.Wrapf(err, "spec.platforms[%d] failed to install", i)
108+
}
109+
klog.Infof("installed spec.platforms[%d]", i)
105110
}
106-
klog.Infof("installed spec.platforms[%d]", i)
111+
log.Printf("all %d spec.platforms installed fine", len(p.Spec.Platforms))
107112
}
108-
log.Printf("all %d spec.platforms installed fine", len(p.Spec.Platforms))
109113
return nil
110114
}
111115

0 commit comments

Comments
 (0)