Skip to content

Commit 52e652c

Browse files
refactor: expand ScanConfig usage in orchestrator functions
- Pass config.sbomgen_version to install_sbomgen() instead of full args object - Add config parameter to invoke_sbomgen() for structured data access - Replace args.artifact_path with config.artifact_path in sbomgen command - Maintain dual args/config system during gradual migration
1 parent bbb3956 commit 52e652c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

entrypoint/entrypoint/orchestrator.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ def execute(args) -> int:
2020

2121
# OLD: Keep existing logic unchanged for now
2222
logging.info(f"downloading and installing inspector-sbomgen version {config.sbomgen_version}")
23-
ret = install_sbomgen(args)
23+
ret = install_sbomgen(config.sbomgen_version)
2424
require_true((ret == 0), "unable to download and install inspector-sbomgen")
2525

2626
logging.info("generating SBOM from artifact")
27-
ret = invoke_sbomgen(args)
27+
ret = invoke_sbomgen(args, config)
2828
require_true(ret == 0, "unable to generate SBOM with inspector-sbomgen")
2929

3030
logging.info("scanning SBOM contents with Amazon Inspector")
@@ -152,7 +152,7 @@ def get_sbomgen_arch(host_cpu):
152152
return None
153153

154154

155-
def invoke_sbomgen(args) -> int:
155+
def invoke_sbomgen(args, config) -> int:
156156
sbomgen = installer.get_sbomgen_install_path()
157157
if sbomgen == "":
158158
logging.error("expected path to inspector-sbomgen but received empty string")
@@ -183,7 +183,7 @@ def invoke_sbomgen(args) -> int:
183183

184184
# invoke sbomgen with arguments
185185
sbomgen_args = [args.artifact_type,
186-
path_arg, args.artifact_path,
186+
path_arg, config.artifact_path,
187187
"--outfile", args.out_sbom,
188188
"--disable-progress-bar",
189189
"--timeout", str(config.timeout),
@@ -439,10 +439,10 @@ def get_fixed_vuln_counts(inspector_scan_path: str) -> tuple[bool, fixed_vulns.F
439439
return True, fixed_vulns_counts
440440

441441

442-
def install_sbomgen(args):
442+
def install_sbomgen(sbomgen_version):
443443
os_name = platform.system()
444444
if "Linux" in os_name:
445-
ret = download_install_sbomgen(args.sbomgen_version, "/usr/local/bin/inspector-sbomgen")
445+
ret = download_install_sbomgen(sbomgen_version, "/usr/local/bin/inspector-sbomgen")
446446
if not ret:
447447
return 1
448448

0 commit comments

Comments
 (0)