feat: add asset_filter to releases.conf, fix kubectx/kubens split

asset_filter is a substring that asset filenames must contain. Used when
multiple packages share a GitHub release (kubectx/kubens both come from
ahmetb/kubectx). Added as a first-class Conf field and applied in
webicached's applyConfig.
This commit is contained in:
AJ ONeal
2026-03-10 14:42:37 -06:00
parent 34dcc6c148
commit b408b42464
5 changed files with 24 additions and 7 deletions

View File

@@ -230,13 +230,21 @@ func (wc *WebiCache) refreshPackage(ctx context.Context, pkg pkgConf) error {
return nil
}
// applyConfig applies version prefix stripping and exclude filters.
// applyConfig applies asset_filter, exclude, and version prefix stripping.
func applyConfig(assets []storage.Asset, conf *installerconf.Conf) []storage.Asset {
filter := strings.ToLower(conf.AssetFilter)
excludes := conf.Exclude
prefixes := conf.VersionPrefixes
var out []storage.Asset
for _, a := range assets {
lower := strings.ToLower(a.Filename)
// Include filter: asset must contain this substring.
if filter != "" && !strings.Contains(lower, filter) {
continue
}
// Exclude filter.
skip := false
for _, ex := range excludes {