fix: release check (#44)
All checks were successful
build / build (push) Successful in 1m17s
build / trigger-build-image (push) Successful in 5s

Co-authored-by: zzjc1234 <2359047351@qq.com>
Reviewed-on: #44
Reviewed-by: 张泊明518370910136 <bomingzh@sjtu.edu.cn>
Co-authored-by: 周赵嘉程521432910016 <zzjc123@sjtu.edu.cn>
Co-committed-by: 周赵嘉程521432910016 <zzjc123@sjtu.edu.cn>
This commit is contained in:
周赵嘉程521432910016 2024-10-01 23:30:07 +08:00 committed by 张泊明518370910136
parent 914ad6c7e3
commit 28bf70d0a9
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.
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())

View File

@ -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
}