Skip to content

Commit

Permalink
DownloadRegex respects local cache hits
Browse files Browse the repository at this point in the history
Currently download_regex is ignored when a local cache hit occurs and uses the download_outputs flag to determine whether outputs should be downloaded. Make local cache hits respect the download_regex flag when set.

Bug: b/348708942
Test: https://paste.googleplex.com/5092424227749888
Change-Id: I6f540178e62b8f958c8ed8daf126a2f66c189ec8
GitOrigin-RevId: fa8c65d9bbdc42bbd03a9567525776b2cd211e06
  • Loading branch information
andusy authored and copybara-github committed Jun 27, 2024
1 parent 612b147 commit f855ad9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/pkg/reproxy/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,12 @@ func (a *action) getCachedResult(ctx context.Context) {
return
}
a.rec.LocalMetadata.ValidCacheHit = true
outDir := a.cmd.ExecRoot
outs, err := a.execContext.GetFlattenedOutputs()
if err != nil {
log.Errorf("%v: Unable to get flattened outputs from Action Result: %v", a.cmd.Identifiers.ExecutionID, err)
}
a.execContext.DownloadSpecifiedOutputs(a.excludeOutputsViaFilter(outs), outDir)
}

func (a *action) cacheLocal() {
Expand Down
3 changes: 3 additions & 0 deletions internal/pkg/reproxy/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,9 @@ func (s *Server) rerunAction(ctx context.Context, a *action) {
}

func (s *Server) runLERC(ctx context.Context, a *action) {
if a.downloadRegex != "" {
a.rOpt.DownloadOutputs = false
}
if err := a.createExecContext(ctx, s.REClient); err != nil {
// This cannot really happen, as the only error it checks for is cmd.Validate.
a.res = command.NewLocalErrorResult(err)
Expand Down

0 comments on commit f855ad9

Please sign in to comment.