mirror of
https://github.com/webinstall/webi-installers.git
synced 2026-04-22 09:56:35 +00:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user