-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve all lint issues, add e2e test on CI
- Loading branch information
Showing
19 changed files
with
293 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Echo executor | ||
|
||
Echo is the example Botkube executor used during [e2e tests](../../../test/e2e). | ||
|
||
## Configuration parameters | ||
|
||
The Echo configuration should be specified in YAML format. It accepts such parameters: | ||
|
||
```yaml | ||
changeResponseToUpperCase: true # default is 'false'. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package plugin | ||
|
||
import ( | ||
"github.com/kubeshop/botkube/pkg/config" | ||
) | ||
|
||
// GetAllEnabledAndUsedPluginExecutors returns the list of all plugins executors that are both enabled and bind to at | ||
// least one communicator that is also enabled. | ||
func GetAllEnabledAndUsedPluginExecutors(cfg *config.Config) []string { | ||
// Collect all used executor bindings | ||
bindExecutors := map[string]struct{}{} | ||
collect := func(channels config.IdentifiableMap[config.ChannelBindingsByName]) { | ||
for _, bindings := range channels { | ||
for _, name := range bindings.Bindings.Executors { | ||
bindExecutors[name] = struct{}{} | ||
} | ||
} | ||
} | ||
|
||
for _, commGroupCfg := range cfg.Communications { | ||
if commGroupCfg.Slack.Enabled { | ||
collect(commGroupCfg.Slack.Channels) | ||
} | ||
|
||
if commGroupCfg.SocketSlack.Enabled { | ||
collect(commGroupCfg.SocketSlack.Channels) | ||
} | ||
|
||
if commGroupCfg.Mattermost.Enabled { | ||
collect(commGroupCfg.Mattermost.Channels) | ||
} | ||
|
||
if commGroupCfg.Teams.Enabled { | ||
for _, name := range commGroupCfg.Teams.Bindings.Executors { | ||
bindExecutors[name] = struct{}{} | ||
} | ||
} | ||
|
||
if commGroupCfg.Discord.Enabled { | ||
for _, bindings := range commGroupCfg.Discord.Channels { | ||
for _, name := range bindings.Bindings.Executors { | ||
bindExecutors[name] = struct{}{} | ||
} | ||
} | ||
} | ||
} | ||
|
||
// Collect all executors that are both enabled and bind to at least one communicator that is enabled. | ||
var usedExecutorPlugins []string | ||
for groupName, groupItems := range cfg.Executors { | ||
for name, executor := range groupItems.Plugins { | ||
if !executor.Enabled { | ||
continue | ||
} | ||
_, found := bindExecutors[groupName] | ||
if !found { | ||
continue | ||
} | ||
|
||
usedExecutorPlugins = append(usedExecutorPlugins, name) | ||
} | ||
} | ||
|
||
return usedExecutorPlugins | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.