From 3a197732d8f92320262f0e6da4d9634e9c6aa3aa Mon Sep 17 00:00:00 2001 From: Jared Allard Date: Tue, 4 Mar 2025 16:57:14 -0800 Subject: [PATCH] updater: support ignoring versions --- .tools/internal/config/packages/packages.go | 4 ++++ .tools/internal/resolver/git.go | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/.tools/internal/config/packages/packages.go b/.tools/internal/config/packages/packages.go index c07eecb..8a1efc1 100644 --- a/.tools/internal/config/packages/packages.go +++ b/.tools/internal/config/packages/packages.go @@ -141,6 +141,10 @@ type GitOptions struct { // when a tag is used and the version is able to be parsed as a // semver. Defaults to false. ConsiderPreReleases bool `yaml:"consider_pre_releases"` + + // IgnoreVersions is a list of versions to always ignore (looking at + // you, Zed). + IgnoreVersions []string `yaml:"ignore_versions"` } // APTOptions contains the options for the APT resolver. diff --git a/.tools/internal/resolver/git.go b/.tools/internal/resolver/git.go index 70f50c0..bb71802 100644 --- a/.tools/internal/resolver/git.go +++ b/.tools/internal/resolver/git.go @@ -21,6 +21,7 @@ import ( "fmt" "os" "os/exec" + "slices" "strings" "github.com/blang/semver/v4" @@ -69,6 +70,11 @@ func getGitVersion(ce *packages.Package) (string, error) { // Strip the "refs/tags/" prefix. tag := strings.TrimPrefix(fqTag, "refs/tags/") + // Ignore the version if told to do so. + if slices.Contains(ce.GitOptions.IgnoreVersions, tag) { + continue + } + // Attempt to parse as a semver, for other options. if sv, err := semver.ParseTolerant(tag); err == nil { isPreRelease := len(sv.Pre) > 0