From 2fd3af182d58c388b7940bdf7dcb6d0284135aac Mon Sep 17 00:00:00 2001 From: zzjc1234 <2359047351@qq.com> Date: Tue, 1 Oct 2024 17:24:08 +0800 Subject: [PATCH] fix: release check --- cmd/healthcheck/main.go | 4 +--- pkg/healthcheck/tag.go | 6 +++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cmd/healthcheck/main.go b/cmd/healthcheck/main.go index ca09048..97f9515 100644 --- a/cmd/healthcheck/main.go +++ b/cmd/healthcheck/main.go @@ -39,7 +39,7 @@ var Version string // Generally, err is used for runtime errors, and checkRes is used for the result of the checks. func main() { - var gitWhitelist, metaFile, releaseTags []string + var gitWhitelist, metaFile []string showVersion := flag.Bool("version", false, "print current version") rootDir := flag.String("root", "", "") repo := flag.String("repo", "", "") @@ -51,7 +51,6 @@ func main() { checkFileSumList := flag.String("checkFileSumList", "", "Comma-separated list of expected checksums.") parseMultiValueFlag(&gitWhitelist, "whitelist", "") parseMultiValueFlag(&metaFile, "meta", "") - parseMultiValueFlag(&releaseTags, "releaseTags", "") flag.Parse() if *showVersion { fmt.Println(Version) @@ -83,7 +82,6 @@ func main() { if err != nil { fmt.Printf("## Release Tag Check Failed:\n%s\n", err.Error()) } - // FIXME: for drone usage err = healthcheck.VerifyFiles(*rootDir, *checkFileNameList, *checkFileSumList) if err != nil { fmt.Printf("## Repo File Check Failed:\n%s\n", err.Error()) diff --git a/pkg/healthcheck/tag.go b/pkg/healthcheck/tag.go index d0f7f76..80c343f 100644 --- a/pkg/healthcheck/tag.go +++ b/pkg/healthcheck/tag.go @@ -32,6 +32,10 @@ func getTagsFromRepo(repoPath string) ([]string, error) { } func CheckTags(repoPath string, category string, n int) error { + // INFO: if category not specified, skipping this check by default + if category == "" { + return nil + } tags, err := getTagsFromRepo(repoPath) if err != nil { return fmt.Errorf("error getting tags: %v", err) @@ -56,7 +60,7 @@ func CheckTags(repoPath string, category string, n int) error { } } if !found { - return fmt.Errorf("Wrong release tag '%s' or missing release tags. Please use one of '%s'.", target, strings.Join(tags, "', '")) + return fmt.Errorf("Wrong release tag '%s' or missing release tags. Please use one of '%s'.", strings.Join(tags, "', '"), target) } return nil } -- 2.30.2