1
0
Fork 0

Merge current v2.11 into v3.6

This commit is contained in:
mmatur 2025-12-01 15:03:33 +01:00
commit b9c2e757c7
No known key found for this signature in database
GPG key ID: 2FFE42FC256CFF8E
8 changed files with 141 additions and 50 deletions

View file

@ -8,6 +8,7 @@ import (
"github.com/hashicorp/go-multierror"
"github.com/rs/zerolog/log"
"golang.org/x/mod/module"
)
const localGoPath = "./plugins-local/"
@ -53,24 +54,18 @@ func checkRemotePluginsConfiguration(plugins map[string]Descriptor) error {
var errs []string
for pAlias, descriptor := range plugins {
if descriptor.ModuleName == "" {
errs = append(errs, fmt.Sprintf("%s: plugin name is missing", pAlias))
if err := module.CheckPath(descriptor.ModuleName); err != nil {
errs = append(errs, fmt.Sprintf("%s: malformed plugin module name is missing: %s", pAlias, err))
}
if descriptor.Version == "" {
errs = append(errs, fmt.Sprintf("%s: plugin version is missing", pAlias))
}
if strings.HasPrefix(descriptor.ModuleName, "/") || strings.HasSuffix(descriptor.ModuleName, "/") {
errs = append(errs, fmt.Sprintf("%s: plugin name should not start or end with a /", pAlias))
continue
}
if _, ok := uniq[descriptor.ModuleName]; ok {
errs = append(errs, fmt.Sprintf("only one version of a plugin is allowed, there is a duplicate of %s", descriptor.ModuleName))
continue
}
uniq[descriptor.ModuleName] = struct{}{}
}