CI: Add GOCACHEPROG to the backend builder if GOCACHEPROG is set on the host (#107256)

This commit is contained in:
Kevin Minehart
2025-06-26 14:16:58 +00:00
committed by GitHub
parent bca70ee809
commit dd2ba2e816
2 changed files with 13 additions and 0 deletions
@@ -3,6 +3,7 @@ package artifacts
import (
"context"
"log/slog"
"os"
"path/filepath"
"dagger.io/dagger"
@@ -191,10 +192,17 @@ func NewBackendFromString(ctx context.Context, log *slog.Logger, artifact string
return nil, err
}
goCacheProg := ""
// If the caller has GOCACHEPROG set, then reuse it
if val, ok := os.LookupEnv("GOCACHEPROG"); ok {
goCacheProg = val
}
bopts := &backend.BuildOpts{
Version: p.Version,
Enterprise: p.Enterprise,
ExperimentalFlags: experiments,
GoCacheProg: goCacheProg,
Static: static,
WireTag: wireTag,
Tags: tags,
+5
View File
@@ -16,6 +16,7 @@ type BuildOpts struct {
ExperimentalFlags []string
Tags []string
WireTag string
GoCacheProg string
Static bool
Enterprise bool
}
@@ -154,6 +155,10 @@ func Builder(
WithMountedCache("/root/.cache/go", goBuildCache).
WithEnvVariable("GOCACHE", "/root/.cache/go")
if prog := opts.GoCacheProg; prog != "" {
builder = builder.WithEnvVariable("GOCACHEPROG", prog)
}
commitInfo := GetVCSInfo(src, version, opts.Enterprise)
builder = withCue(builder, src).