klesh opened a new pull request, #9288:
URL: https://github.com/apache/devlake/pull/9288

   ### Summary
   
   First step of #9276. Plugins were only discoverable at runtime, through the 
`.so` files in `PLUGIN_DIR`; this adds the compile-time path so the whole 
plugin set can be linked into one binary.
   
   - `core/plugin.MustRegister` registers a plugin under the name it reports, 
panicking on a nil plugin or an empty name. Overwrite semantics are unchanged, 
so a plugin that is both compiled in and loaded from a `.so` keeps working.
   - `tools/pluginsgen` scans `plugins/*/impl` for the type whose method set 
covers `plugin.PluginMeta` (`Name`, `Description`, `RootPkgPath`) and generates 
`plugins/all/all.go`, which imports each plugin and registers it from `init`. 
It fails loudly when a package has no such type or has several.
   - `plugins/all/external.go` is the `devlake_external_plugins` build-tag 
counterpart, for a plugin-free core binary that loads `.so` files instead.
   - `server/main.go` blank-imports the registry — the one framework→plugin 
edge the layering guard permits.
   - `runner.LoadGoPlugins` now treats a missing `PLUGIN_DIR` as "no 
shared-object plugins" instead of failing startup, so a single-binary 
deployment does not need to ship an empty directory.
   - CI regenerates the registry and fails when the checked-in file drifts, 
next to the existing `go mod tidy` check.
   
   `DEVLAKE_PLUGINS` is honoured by the generator, so `jira,gitlab` produces a 
two-plugin registry and `none` produces an empty one — the same values 
`scripts/build-plugins.sh` already accepts.
   
   ### Does this close any open issues?
   
   Part of #9276. Build scripts and Dockerfiles are deliberately untouched 
here: `make build` still produces the `.so` files, and they register over the 
compiled-in ones harmlessly. Repackaging follows in a separate PR.
   
   ### Screenshots
   
   N/A
   
   ### Other Information
   
   Verified locally:
   
   ```
   go build ./server                                  # ok
   go build -tags devlake_external_plugins ./server    # ok, empty registry
   DEVLAKE_PLUGINS=jira,gitlab go run ./tools/pluginsgen -o /tmp/subset.go
   DEVLAKE_PLUGINS=none go run ./tools/pluginsgen -o /tmp/none.go
   ```
   
   A throwaway test asserting `len(plugin.AllPlugins()) == 47` passed, 
including the awkward names (`gh-copilot`, `grafana_irm`, `issue_trace`, 
`gitextractor`), and regeneration is deterministic.
   
   The registry is what makes the single binary possible: with it linked, an 
unstripped `go build ./server` is 149 MB — the same plugin set as ~3.0 GB of 
`.so` files. Stripping and the Dockerfile changes are the next PR.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to