Plugins: Do not fail bootstrap stage if single decorate step fails (#73147)

* don't fail all if decorate step fails

* fix casing

* include err too

* cover pluginsintegration too
This commit is contained in:
Will Browne
2023-08-10 14:46:38 +02:00
committed by GitHub
parent 67de18ff06
commit c5e9a82ccb
19 changed files with 75 additions and 69 deletions

View File

@ -69,14 +69,22 @@ func (b *Bootstrap) Bootstrap(ctx context.Context, src plugins.PluginSource, fou
return ps, nil
}
bootstrappedPlugins := make([]*plugins.Plugin, 0, len(ps))
for _, p := range ps {
for _, decorator := range b.decorateSteps {
p, err = decorator(ctx, p)
var ip *plugins.Plugin
stepFailed := false
for _, decorate := range b.decorateSteps {
ip, err = decorate(ctx, p)
if err != nil {
return nil, err
stepFailed = true
b.log.Error("Could not decorate plugin", "pluginId", p.ID, "error", err)
break
}
}
if !stepFailed {
bootstrappedPlugins = append(bootstrappedPlugins, ip)
}
}
return ps, nil
return bootstrappedPlugins, nil
}