@@ -69,6 +69,7 @@ class MultiImageProjectManager():
69
69
def __init__ (self , args ):
70
70
self .debug = args .debug
71
71
self .binary = args .binary
72
+ self .individual_file_matching = args .individual_file_matching
72
73
self .log_config ()
73
74
self .base_url = args .base_url
74
75
with open (args .token_file , 'r' ) as tf :
@@ -399,6 +400,8 @@ def scan_container_images(self):
399
400
detect_options = (f"--detect.parent.project.name={ parent_project } "
400
401
f"--detect.parent.project.version.name={ parent_version } "
401
402
f"--detect.project.version.nickname={ image_name } " )
403
+ if self .individual_file_matching :
404
+ detect_options += f" --detect.blackduck.signature.scanner.individual.file.matching=ALL"
402
405
if clone_from :
403
406
detect_options += f" --detect.clone.project.version.name={ clone_from } "
404
407
if project_group :
@@ -452,6 +455,7 @@ def parse_command_args():
452
455
parser .add_argument ("-d" , "--debug" , action = 'store_true' , help = "Set debug output on" )
453
456
parser .add_argument ("--strict" , action = 'store_true' , help = "Fail if existing (sub)project versions already exist" )
454
457
parser .add_argument ("--binary" , action = 'store_true' , help = "Use binary scan for analysis" )
458
+ parser .add_argument ("-ifm" , "--individual-file-matching" , action = 'store_true' , help = "Turn Individual file matching on" )
455
459
return parser .parse_args ()
456
460
457
461
def main ():
@@ -461,28 +465,30 @@ def main():
461
465
mipm = MultiImageProjectManager (args )
462
466
logging .info (f"Parsed { len (mipm .project_data ['subprojects' ])} projects from specification data" )
463
467
mipm .proceed ()
464
- filename_complete = f"{ args .project_name } -{ args .version_name } -{ timestamp } -full.json"
465
- filename_failures = f"{ args .project_name } -{ args .version_name } -{ timestamp } -failures.json"
466
- # write full processing log
467
- with open (filename_complete , "w" ) as f :
468
- json .dump (mipm .project_data , f , indent = 2 )
469
-
470
- failures = list ()
471
- for sname , sub in mipm .project_data ['subprojects' ].items ():
472
- structure = False
473
- runtime = False
474
- if sub ['status' ] != 'PRESENT' :
475
- structure = True
476
- if not sub .get ('scan_results' , None ):
477
- runtime = True
478
- else :
479
- rcodes = [r ['scan_results' ]['returncode' ] for r in sub ['scan_results' ] if r .get ('scan_results' , None )]
480
- if sum (rcodes ) > 0 :
468
+
469
+ if not args .remove :
470
+ filename_complete = f"{ args .project_name } -{ args .version_name } -{ timestamp } -full.json"
471
+ filename_failures = f"{ args .project_name } -{ args .version_name } -{ timestamp } -failures.json"
472
+ # write full processing log
473
+ with open (filename_complete , "w" ) as f :
474
+ json .dump (mipm .project_data , f , indent = 2 )
475
+
476
+ failures = list ()
477
+ for sname , sub in mipm .project_data ['subprojects' ].items ():
478
+ structure = False
479
+ runtime = False
480
+ if sub ['status' ] != 'PRESENT' :
481
+ structure = True
482
+ if not sub .get ('scan_results' , None ):
481
483
runtime = True
482
- if structure or runtime :
483
- failures .append (sub )
484
- with open (filename_failures , "w" ) as f :
485
- json .dump (failures , f , indent = 2 )
484
+ else :
485
+ rcodes = [r ['scan_results' ]['returncode' ] for r in sub ['scan_results' ] if r .get ('scan_results' , None )]
486
+ if sum (rcodes ) > 0 :
487
+ runtime = True
488
+ if structure or runtime :
489
+ failures .append (sub )
490
+ with open (filename_failures , "w" ) as f :
491
+ json .dump (failures , f , indent = 2 )
486
492
487
493
if __name__ == "__main__" :
488
494
sys .exit (main ())
0 commit comments