Skip to content

Commit 58b044a

Browse files
omerr-cycodegotbadger
authored andcommitted
CM-61547 added flag to report sbom command
1 parent 60ebd25 commit 58b044a

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

cycode/cli/apps/report/sbom/path/path_command.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
GradleAllSubProjectsOption,
1111
MavenSettingsFileOption,
1212
NoRestoreOption,
13+
StopOnErrorOption,
1314
apply_sca_restore_options_to_context,
1415
)
1516
from cycode.cli.exceptions.handle_report_sbom_errors import handle_report_exception
@@ -30,8 +31,9 @@ def path_command(
3031
no_restore: NoRestoreOption = False,
3132
gradle_all_sub_projects: GradleAllSubProjectsOption = False,
3233
maven_settings_file: MavenSettingsFileOption = None,
34+
stop_on_error: StopOnErrorOption = False,
3335
) -> None:
34-
apply_sca_restore_options_to_context(ctx, no_restore, gradle_all_sub_projects, maven_settings_file)
36+
apply_sca_restore_options_to_context(ctx, no_restore, gradle_all_sub_projects, maven_settings_file, stop_on_error)
3537

3638
client = get_report_cycode_client(ctx)
3739
report_parameters = ctx.obj['report_parameters']
@@ -51,6 +53,7 @@ def path_command(
5153
consts.SCA_SCAN_TYPE,
5254
(str(path),),
5355
is_cycodeignore_allowed=is_cycodeignore_allowed_by_scan_config(ctx),
56+
stop_on_error=stop_on_error,
5457
)
5558
# TODO(MarshalX): combine perform_pre_scan_documents_actions with get_relevant_document.
5659
# unhardcode usage of context in perform_pre_scan_documents_actions

cycode/cli/apps/sca_options.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,24 @@
3535
),
3636
]
3737

38+
StopOnErrorOption = Annotated[
39+
bool,
40+
typer.Option(
41+
'--stop-on-error',
42+
help='When specified, stops the process if any file collection or restore failure occurs.',
43+
rich_help_panel=_SCA_RICH_HELP_PANEL,
44+
),
45+
]
46+
3847

3948
def apply_sca_restore_options_to_context(
4049
ctx: typer.Context,
4150
no_restore: bool,
4251
gradle_all_sub_projects: bool,
4352
maven_settings_file: Optional[Path],
53+
stop_on_error: bool = False,
4454
) -> None:
4555
ctx.obj['no_restore'] = no_restore
4656
ctx.obj['gradle_all_sub_projects'] = gradle_all_sub_projects
4757
ctx.obj['maven_settings_file'] = maven_settings_file
58+
ctx.obj['stop_on_error'] = stop_on_error

0 commit comments

Comments
 (0)