@@ -69,6 +69,7 @@ class MultiImageProjectManager():
6969 def __init__ (self , args ):
7070 self .debug = args .debug
7171 self .binary = args .binary
72+ self .individual_file_matching = args .individual_file_matching
7273 self .log_config ()
7374 self .base_url = args .base_url
7475 with open (args .token_file , 'r' ) as tf :
@@ -399,6 +400,8 @@ def scan_container_images(self):
399400 detect_options = (f"--detect.parent.project.name={ parent_project } "
400401 f"--detect.parent.project.version.name={ parent_version } "
401402 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"
402405 if clone_from :
403406 detect_options += f" --detect.clone.project.version.name={ clone_from } "
404407 if project_group :
@@ -452,6 +455,7 @@ def parse_command_args():
452455 parser .add_argument ("-d" , "--debug" , action = 'store_true' , help = "Set debug output on" )
453456 parser .add_argument ("--strict" , action = 'store_true' , help = "Fail if existing (sub)project versions already exist" )
454457 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" )
455459 return parser .parse_args ()
456460
457461def main ():
@@ -461,28 +465,30 @@ def main():
461465 mipm = MultiImageProjectManager (args )
462466 logging .info (f"Parsed { len (mipm .project_data ['subprojects' ])} projects from specification data" )
463467 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 ):
481483 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 )
486492
487493if __name__ == "__main__" :
488494 sys .exit (main ())
0 commit comments