fix: release check #44

Merged
张泊明518370910136 merged 1 commits from fix/ignore into master 2024-10-01 23:30:07 +08:00
2 changed files with 6 additions and 4 deletions

View File

@ -39,7 +39,7 @@ var Version string
// Generally, err is used for runtime errors, and checkRes is used for the result of the checks. // Generally, err is used for runtime errors, and checkRes is used for the result of the checks.
func main() { func main() {
var gitWhitelist, metaFile, releaseTags []string var gitWhitelist, metaFile []string
showVersion := flag.Bool("version", false, "print current version") showVersion := flag.Bool("version", false, "print current version")
rootDir := flag.String("root", "", "") rootDir := flag.String("root", "", "")
repo := flag.String("repo", "", "") repo := flag.String("repo", "", "")
@ -51,7 +51,6 @@ func main() {
checkFileSumList := flag.String("checkFileSumList", "", "Comma-separated list of expected checksums.") checkFileSumList := flag.String("checkFileSumList", "", "Comma-separated list of expected checksums.")
parseMultiValueFlag(&gitWhitelist, "whitelist", "") parseMultiValueFlag(&gitWhitelist, "whitelist", "")
parseMultiValueFlag(&metaFile, "meta", "") parseMultiValueFlag(&metaFile, "meta", "")
parseMultiValueFlag(&releaseTags, "releaseTags", "")
flag.Parse() flag.Parse()
if *showVersion { if *showVersion {
fmt.Println(Version) fmt.Println(Version)
@ -83,7 +82,6 @@ func main() {
if err != nil { if err != nil {
fmt.Printf("## Release Tag Check Failed:\n%s\n", err.Error()) fmt.Printf("## Release Tag Check Failed:\n%s\n", err.Error())
} }
// FIXME: for drone usage
err = healthcheck.VerifyFiles(*rootDir, *checkFileNameList, *checkFileSumList) err = healthcheck.VerifyFiles(*rootDir, *checkFileNameList, *checkFileSumList)
if err != nil { if err != nil {
fmt.Printf("## Repo File Check Failed:\n%s\n", err.Error()) fmt.Printf("## Repo File Check Failed:\n%s\n", err.Error())

View File

@ -32,6 +32,10 @@ func getTagsFromRepo(repoPath string) ([]string, error) {
} }
func CheckTags(repoPath string, category string, n int) 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) tags, err := getTagsFromRepo(repoPath)
if err != nil { if err != nil {
return fmt.Errorf("error getting tags: %v", err) return fmt.Errorf("error getting tags: %v", err)
@ -56,7 +60,7 @@ func CheckTags(repoPath string, category string, n int) error {
} }
} }
if !found { 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 return nil
} }