@@ -2,6 +2,7 @@ use std::borrow::Cow;
2
2
use std:: collections:: btree_map:: Entry ;
3
3
use std:: collections:: { BTreeMap , HashSet } ;
4
4
use std:: io:: { IsTerminal , Read } ;
5
+ use std:: path:: PathBuf ;
5
6
use std:: sync:: { Arc , Mutex } ;
6
7
use std:: time:: Duration ;
7
8
@@ -381,6 +382,7 @@ struct Run {
381
382
masker : Arc < Masker > ,
382
383
ids : Vec < i64 > ,
383
384
cancel_behaviour : Option < JobCancelBehaviour > ,
385
+ repo_path : Option < PathBuf > ,
384
386
}
385
387
386
388
impl Run {
@@ -397,6 +399,11 @@ impl Run {
397
399
. collect :: < Vec < _ > > ( ) ;
398
400
let masker = Arc :: new ( Masker :: new ( & masked, MASK_PATTERN ) ) ;
399
401
402
+ let repo_path = job
403
+ . checkout_repo ( )
404
+ . map_err ( |e| outputln ! ( "Failed to checkout repo: {}" , e. to_string( ) ) )
405
+ . ok ( ) ;
406
+
400
407
Self {
401
408
lava : lava. clone ( ) ,
402
409
store : Arc :: new ( AvailableArtifactStore :: new ( lava, masker. clone ( ) ) ) ,
@@ -405,10 +412,21 @@ impl Run {
405
412
masker,
406
413
ids : Vec :: new ( ) ,
407
414
cancel_behaviour,
415
+ repo_path,
408
416
}
409
417
}
410
418
411
419
async fn find_file ( & self , filename : & str ) -> Result < Vec < u8 > , ( ) > {
420
+ if let Some ( repo_path) = & self . repo_path {
421
+ let path = repo_path. join ( filename) ;
422
+ if path. exists ( ) {
423
+ let data = tokio:: fs:: read ( & path) . await . map_err ( |e| {
424
+ outputln ! ( "Failed to read repo file {:?}: {}" , path, e. to_string( ) )
425
+ } ) ?;
426
+ return Ok ( data) ;
427
+ }
428
+ }
429
+
412
430
for d in self . job . dependencies ( ) {
413
431
let artifact = match d. download ( ) . await {
414
432
Ok ( a) => a,
@@ -434,7 +452,7 @@ impl Run {
434
452
} ;
435
453
}
436
454
}
437
- outputln ! ( "{} not found in artifacts" , filename) ;
455
+ outputln ! ( "{} not found in repo or artifacts" , filename) ;
438
456
Err ( ( ) )
439
457
}
440
458
0 commit comments