CI: Add GOCACHEPROG to the backend builder if GOCACHEPROG is set on the host (#107256)
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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).
|
||||
|
||||
Reference in New Issue
Block a user