From 6a308e75b805baf8b404a85710f81b56d47e477c Mon Sep 17 00:00:00 2001 From: Cal Bera Date: Fri, 25 Jul 2025 12:46:16 -0700 Subject: [PATCH] test: add Docker build test workflow for PR validation (#33) * test: add Docker build test workflow for PR validation * fix: use dockerx command without upload flag for testing * testing docker upload * nit * bet * remove --- .gitignore | 3 +++ internal/build/env.go | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) 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