Skip to content

Commit

Permalink
feat(plugins): added checks results in interface passed to plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
StanGirard committed Sep 26, 2022
1 parent e9678c2 commit 894ab98
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 133 deletions.
10 changes: 6 additions & 4 deletions internal/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func initialisePlugins(configuration commons.Config) error {
return nil
}

func RunChecksPlugins(configuration *commons.Config, checks *[]commons.Tests) {
func runChecksPlugins(configuration *commons.Config, checks *[]commons.Tests) {
for _, plugins := range configuration.Plugins {
if plugins.Type == "checks" || plugins.Type == "" {

Expand Down Expand Up @@ -92,7 +92,7 @@ func runModPlugins(configuration *commons.Config, checks *[]commons.Tests) bool
return mod
}

func RunReportPlugins(configuration *commons.Config, checks *[]commons.Tests) {
func runReportPlugins(configuration *commons.Config, checks *[]commons.Tests) {
for _, plugins := range configuration.Plugins {
if plugins.Type == "report" {
latestVersion, _ := commons.GetLatestReleaseTag(plugins)
Expand Down Expand Up @@ -127,7 +127,7 @@ func Execute() error {
}

// Run plugins
RunChecksPlugins(configuration, &checks)
runChecksPlugins(configuration, &checks)

// Clean results
checks = report.RemoveIgnored(configuration, checks)
Expand All @@ -142,14 +142,16 @@ func Execute() error {
})
}

configuration.Tests = checks

// Compare with previous report
compareResults(configuration, &checks)

// CI reporting
ciReporting(checks)

// Run report plugins
RunReportPlugins(configuration, &checks)
runReportPlugins(configuration, &configuration.Tests)

return nil
}
1 change: 1 addition & 0 deletions plugins/commons/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type Config struct {
AWS []AWS_Account `yaml:"aws"`
Ignore []Ignore `yaml:"ignore"`
PluginConfig []map[string]interface{} `yaml:"pluginsConfiguration"`
Tests []Tests `yaml:"tests"`
}

func ParseConfig(configFile string) (*Config, error) {
Expand Down
50 changes: 0 additions & 50 deletions plugins/custom/custom.go

This file was deleted.

78 changes: 0 additions & 78 deletions plugins/custom/custom_test.go

This file was deleted.

2 changes: 1 addition & 1 deletion plugins/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func RunPlugin(pluginInput commons.Plugin, c *commons.Config) []commons.Tests {
// This prevents users from executing bad plugins or executing a plugin
// directory. It is a UX feature, not a security feature.
var handshakeConfig = plugin.HandshakeConfig{
ProtocolVersion: 2,
ProtocolVersion: 3,
MagicCookieKey: "BASIC_PLUGIN",
MagicCookieValue: "hello",
}
Expand Down

0 comments on commit 894ab98

Please sign in to comment.