Skip to content

Commit

Permalink
Don't digest local inputs in buildkit builds by default (#1365)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavolmarko authored Dec 30, 2024
1 parent 5e0c08a commit bde49a3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/build/buildkit/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (l *baseRequest[V]) Inputs() *compute.In {
for k, local := range l.localDirs {
in = in.
Computable(fmt.Sprintf("local%d:contents", k), memfs.DeferSnapshot(local.Module.ReadOnlyFS(local.Path), memfs.SnapshotOpts{
ExcludePatterns: local.ExcludePatterns,
ExcludePatterns: MakeLocalExcludes(local),
})).
Str(fmt.Sprintf("local%d:path", k), local.Path)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/build/buildkit/computable.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const (
var SkipExpectedMaxWorkspaceSizeCheck = false

// XXX make this a flag instead. The assumption here is that in CI the filesystem is readonly.
var PreDigestLocalInputs = environment.IsRunningInCI()
var PreDigestLocalInputs = environment.IsRunningInCI() || !environment.DigestLocalInputs()

type LocalContents struct {
Module build.Workspace
Expand Down
4 changes: 4 additions & 0 deletions internal/environment/ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ import "os"
func IsRunningInCI() bool {
return os.Getenv("CI") != ""
}

func DigestLocalInputs() bool {
return os.Getenv("DIGEST_LOCAL_INPUTS") == "true"
}

0 comments on commit bde49a3

Please sign in to comment.