Skip to content

Commit

Permalink
wire up validations config
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Goodman <[email protected]>
  • Loading branch information
wagoodman committed Jan 23, 2025
1 parent 2b0bd94 commit 1072377
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion manager/src/grype_db_manager/cli/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,11 @@ def validate_db(
_validate_db(ctx, cfg, db_info, images, db_uuid, recapture, force=force)

if db_info.schema_version >= 6:
logging.info(f"validating latest.json {db_uuid}")
validations_enabled = db.schema.validations_enabled(db_info.schema_version)
if not validations_enabled and not force:
click.echo(f"{Format.BOLD}{Format.OKGREEN}Validation disabled, skipping{Format.RESET}")
return

_validate_latest(cfg, db_info.latest_path, db_info.archive_path)

click.echo(f"{Format.BOLD}{Format.OKGREEN}Validation passed{Format.RESET}")
Expand Down Expand Up @@ -266,6 +270,8 @@ def _validate_latest(cfg: config.Application, latest_file: str, archive_path: st
msg = "minimum vulnerabilities must be specified"
raise ValueError(msg)

logging.debug(f"validating latest.json with {cfg.validate.listing.image}")

db.latest.smoke_test(
latest_obj,
archive_path,
Expand Down

0 comments on commit 1072377

Please sign in to comment.