internal/build: parse buildbot tag better

pull/26029/head
Felix Lange 3 years ago
parent c78ea526b8
commit 29685bbe91
  1. 7
      internal/build/env.go

@ -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")

Loading…
Cancel
Save