internal/build: parse buildbot tag better

This commit is contained in:
Felix Lange 2022-05-20 19:59:26 +02:00
parent c78ea526b8
commit 29685bbe91
1 changed files with 3 additions and 4 deletions

View File

@ -97,11 +97,10 @@ func Env() Environment {
// we can distinguish them by the git refspec.
var branch, tag string
branchSpec := os.Getenv("BUILD_BRANCH")
switch {
case strings.HasPrefix(branchSpec, "refs/heads/"):
branch = strings.TrimPrefix(branchSpec, "refs/heads/")
case strings.HasPrefix(branchSpec, "refs/tags/"):
if strings.HasPrefix(branchSpec, "refs/tags/") {
tag = strings.TrimPrefix(branchSpec, "refs/tags/")
} else {
branch = branchSpec
}
commit := os.Getenv("BUILD_COMMIT")