@@ -286,7 +286,7 @@ func (f *fileToUpload) FileNode() *repb.FileNode {
286
286
}
287
287
}
288
288
289
- func uploadMissingFiles (ctx context.Context , uploader * cachetools.BatchCASUploader , env environment.Env , filesToUpload []* fileToUpload , instanceName string , digestFunction repb.DigestFunction_Value ) (alreadyPresentBytes int64 , _ error ) {
289
+ func uploadMissingFiles (ctx context.Context , uploader * cachetools.BatchCASUploader , env environment.Env , filesToUpload []* fileToUpload , instanceName string , digestFunction repb.DigestFunction_Value , addToFileCache bool ) (alreadyPresentBytes int64 , _ error ) {
290
290
ctx , cancel := context .WithCancel (ctx )
291
291
defer cancel ()
292
292
@@ -345,17 +345,17 @@ func uploadMissingFiles(ctx context.Context, uploader *cachetools.BatchCASUpload
345
345
fc := env .GetFileCache ()
346
346
for batch := range batches {
347
347
alreadyPresentBytes += batch .presentBytes
348
- if err := uploadFiles (ctx , uploader , fc , batch .files ); err != nil {
348
+ if err := uploadFiles (ctx , uploader , fc , batch .files , addToFileCache ); err != nil {
349
349
return 0 , err
350
350
}
351
351
}
352
352
return alreadyPresentBytes , nil
353
353
}
354
354
355
- func uploadFiles (ctx context.Context , uploader * cachetools.BatchCASUploader , fc interfaces.FileCache , filesToUpload []* fileToUpload ) error {
355
+ func uploadFiles (ctx context.Context , uploader * cachetools.BatchCASUploader , fc interfaces.FileCache , filesToUpload []* fileToUpload , addToFileCache bool ) error {
356
356
for _ , uploadableFile := range filesToUpload {
357
357
// Add output files to the filecache.
358
- if fc != nil {
358
+ if fc != nil && addToFileCache {
359
359
node := uploadableFile .FileNode ()
360
360
if err := fc .AddFile (ctx , node , uploadableFile .fullPath ); err != nil {
361
361
log .Warningf ("Error adding file to filecache: %s" , err )
@@ -446,7 +446,7 @@ func handleSymlink(dirHelper *DirHelper, rootDir string, cmd *repb.Command, acti
446
446
return nil
447
447
}
448
448
449
- func UploadTree (ctx context.Context , env environment.Env , dirHelper * DirHelper , instanceName string , digestFunction repb.DigestFunction_Value , rootDir string , cmd * repb.Command , actionResult * repb.ActionResult ) (* TransferInfo , error ) {
449
+ func UploadTree (ctx context.Context , env environment.Env , dirHelper * DirHelper , instanceName string , digestFunction repb.DigestFunction_Value , rootDir string , cmd * repb.Command , actionResult * repb.ActionResult , addToFileCache bool ) (* TransferInfo , error ) {
450
450
startTime := time .Now ()
451
451
outputDirectoryPaths := make ([]string , 0 )
452
452
filesToUpload := make ([]* fileToUpload , 0 )
@@ -536,7 +536,7 @@ func UploadTree(ctx context.Context, env environment.Env, dirHelper *DirHelper,
536
536
537
537
// Upload output files to the remote cache and also add them to the local
538
538
// cache since they are likely to be used as inputs to subsequent actions.
539
- alreadyPresentBytes , err := uploadMissingFiles (ctx , uploader , env , filesToUpload , instanceName , digestFunction )
539
+ alreadyPresentBytes , err := uploadMissingFiles (ctx , uploader , env , filesToUpload , instanceName , digestFunction , addToFileCache )
540
540
if err != nil {
541
541
return nil , err
542
542
}
0 commit comments