MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / Load

Function Load

app/controlplane/plugins/plugins.go:66–89  ·  view source on GitHub ↗

Load the available third party integrations, these integrations can come in the form of a) Plugins implemented with go-plugin, compiled as a separate binary and placed in pluginsDir b) Built-in plugins implemented as a go modules and loaded in memory Important: Plugins have precedence over built-in

(pluginsDir string, l log.Logger)

Source from the content-addressed store, hash-verified

64// b) Built-in plugins implemented as a go modules and loaded in memory
65// Important: Plugins have precedence over built-in plugins
66func Load(pluginsDir string, l log.Logger) (plugins sdk.AvailablePlugins, err error) {
67 // Array of built-in plugins to enable which are loaded in host memory dynamically
68 toEnableBuiltIn := []sdk.FanOutFactory{
69 dependencytrack.New,
70 smtp.New,
71 discord.New,
72 guac.New,
73 slack.New,
74 webhook.New,
75 }
76
77 // Load plugins in memory from the array above
78 memLoader := &memoryLoader{plugins: toEnableBuiltIn, logger: l}
79
80 logger := servicelogger.ScopedHelper(l, "plugins")
81 // Load plugins from a directory
82 dirLoader := &directoryLoader{
83 pluginsDir: pluginsDir,
84 initializer: &goPluginInitializer{},
85 logger: logger,
86 }
87
88 return doLoad(memLoader, dirLoader, logger)
89}
90
91func doLoad(memoryLoader pluginsLoader, dirLoader pluginsLoader, logger *log.Helper) (plugins sdk.AvailablePlugins, err error) {
92 defer func() {

Callers 2

mainFunction · 0.92
mainEFunction · 0.92

Calls 2

ScopedHelperFunction · 0.92
doLoadFunction · 0.85

Tested by

no test coverage detected