diff --git a/.gitignore b/.gitignore index 5712e250e7..95246d91f7 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,6 @@ cmd/workload/workload # claude .claude + +# for testing docker builds +.github/workflows/docker-test.yml diff --git a/internal/build/env.go b/internal/build/env.go index 1ebdcb3877..b221338af9 100644 --- a/internal/build/env.go +++ b/internal/build/env.go @@ -174,9 +174,12 @@ func LocalEnv() Environment { if info, err := os.Stat(".git/objects"); err == nil && info.IsDir() && env.Tag == "" { // Try to get tag at HEAD first env.Tag = firstLine(RunGit("tag", "-l", "--points-at", "HEAD")) - // If no tag points at HEAD, get the most recent tag + // If no tag points at HEAD, try to get the most recent tag if env.Tag == "" { - env.Tag = firstLine(RunGit("describe", "--tags", "--abbrev=0")) + // Check if there are any tags at all before trying git describe + if tags := RunGit("tag", "-l"); tags != "" { + env.Tag = firstLine(RunGit("describe", "--tags", "--abbrev=0")) + } } } return env