Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: some small changes with validate-plugin command #453

Merged
merged 2 commits into from
May 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions internal/pkg/develop/plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ func (p *Plugin) ValidateFiles(files []pluginTpl.File) error {
if len(errs) != 0 {
log.Debugf("Total number of validation failures: %d.", len(errs))
log.Errorf(strings.Join(errs, "\n"))
log.Errorf("Plugin <%s> does NOT passed validation.", p.Name)
return nil
}

log.Successf("Plugin <%s> passed validation.", p.Name)
return nil
}
Expand Down
9 changes: 5 additions & 4 deletions internal/pkg/develop/plugin/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import (

"github.com/spf13/viper"

"github.com/devstream-io/devstream/pkg/util/log"
"github.com/devstream-io/devstream/cmd/devstream/list"
"github.com/devstream-io/devstream/pkg/util/log"
)

func Validate() error {
validateAll := viper.GetBool("all")

if validateAll {
log.Info("Validate all plugins.")
log.Info("Start validating all plugins.\n")
return ValidatePlugins()
}

Expand All @@ -35,9 +35,11 @@ func ValidatePlugins() error {
sort.Strings(listPluginsName)

for _, pluginName := range listPluginsName {
log.Infof("===== start validating <%s> =====", pluginName)
if err := ValidatePlugin(pluginName); err != nil {
return err
}
log.Infof("===== Finished validate <%s> =====\n", pluginName)
}

return nil
Expand All @@ -55,14 +57,13 @@ func ValidatePlugin(pluginName string) error {
log.Debugf("Failed to render template files: %s.", err)
return err
}
log.Info("Render template files finished.")
log.Debug("Render template files finished.")

// 2. Validate need validate files
if err := p.ValidateFiles(files); err != nil {
log.Debugf("Failed to validate files: %s.", err)
return err
}
log.Info("Validate all files finished.")

return nil
}
1 change: 1 addition & 0 deletions internal/pkg/plugin/argocd/argocd.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package argocd
1 change: 1 addition & 0 deletions internal/pkg/plugin/jenkins/jenkins.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package jenkins
1 change: 1 addition & 0 deletions internal/pkg/plugin/openldap/openldap.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package openldap