|
48 | 48 | Sub-projects could be specified in a text file with -ssf --subproject-spec-file parameter |
49 | 49 | Each line will have to contain full image specification. |
50 | 50 | Specification will be parsed and image name prefixed by -str parameter will be used as a sub-project name |
51 | | -In this mode any image that is not residing on ciena.com repository will be skipped. |
| 51 | +In this mode any image that is not residing on //your domain for example abc.com// repository will be skipped. |
52 | 52 | If -str parameter is empty, Project Name will be used instead. |
53 | 53 |
|
54 | 54 | Container image name scanned will be written into project version nickname field |
@@ -84,6 +84,7 @@ def __init__(self, args): |
84 | 84 | else: |
85 | 85 | self.init_project_data(args) |
86 | 86 | self.serialize = args.serialize |
| 87 | + self.skip_group=args.skip_group |
87 | 88 |
|
88 | 89 | def connect(self): |
89 | 90 | self.client = Client(base_url=self.base_url, token=self.access_token, verify=self.no_verify, timeout=60.0, retries=4) |
@@ -314,15 +315,17 @@ def process_text_spec_file(self,args): |
314 | 315 | prefix = args.string_to_put_in_front_of_subproject_name |
315 | 316 | if not prefix: |
316 | 317 | prefix = args.project_name |
317 | | - with open(args.subproject_spec_file, "r") as f: |
318 | | - lines = f.read().splitlines() |
319 | | - for line in lines: |
320 | | - image_name = line.split('/')[-1].split(':')[0] # Don't look at me, you wrote it! |
321 | | - sub_project_name = "_".join((prefix, image_name)) |
322 | | - spec_line = ":".join((sub_project_name, line)) |
323 | | - # if "ciena.com" in spec_line: |
324 | | - project_list.append(spec_line) |
325 | | - return (project_list) |
| 318 | + if args.subproject_spec_file is not None : |
| 319 | + with open(args.subproject_spec_file, "r") as f: |
| 320 | + lines = f.read().splitlines() |
| 321 | + for line in lines: |
| 322 | + #print(line) |
| 323 | + image_name = line.split('/')[-1].split(':')[0] # Don't look at me, you wrote it! |
| 324 | + sub_project_name = "_".join((prefix, image_name)) |
| 325 | + spec_line = ":".join((sub_project_name, line)) |
| 326 | + # if "//your domain ex. abc.com //" in spec_line: |
| 327 | + project_list.append(spec_line) |
| 328 | + return (project_list) |
326 | 329 |
|
327 | 330 | def get_child_spec_list(self,args): |
328 | 331 | if args.subproject_list: |
@@ -459,7 +462,8 @@ def scan_container_images(self): |
459 | 462 | parent_version, |
460 | 463 | detect_options, |
461 | 464 | hub=hub, |
462 | | - binary=self.binary |
| 465 | + binary=self.binary, |
| 466 | + skip_group = self.skip_group |
463 | 467 | ) |
464 | 468 | child['scan_results'] = results |
465 | 469 | except Exception as e: |
@@ -537,6 +541,7 @@ def parse_command_args(): |
537 | 541 | parser.add_argument("-ifm", "--individual-file-matching", action='store_true', help="Turn Individual file matching on") |
538 | 542 | parser.add_argument("--reprocess-run-file", help="Reprocess Failures from previous run report.") |
539 | 543 | parser.add_argument("--serialize", action='store_true', help="Serialize scan submissions by adding --detect.wait.for.results=true to scan invocations") |
| 544 | + parser.add_argument("--skip-group", required=False, help="exclude layers belog to specific groups, ex. 'base' ") |
540 | 545 | args = parser.parse_args() |
541 | 546 | if not args.reprocess_run_file and not (args.project_name and args.version_name): |
542 | 547 | parser.error("[ -p/--project-name and -pv/--version-name ] or --reprocess-run-file are required") |
@@ -565,3 +570,5 @@ def main(): |
565 | 570 |
|
566 | 571 | if __name__ == "__main__": |
567 | 572 | sys.exit(main()) |
| 573 | + |
| 574 | + |
0 commit comments