SNOW-3202210: Implement snow validate-image CLI command#2809
SNOW-3202210: Implement snow validate-image CLI command#2809sfc-gh-ajiang wants to merge 7 commits intomainfrom
Conversation
fddd9a3 to
b46515f
Compare
32d5ae5 to
2f7d161
Compare
| Validates a Docker image against Snowflake custom image requirements. | ||
| """ | ||
| manager = CustomImageManager(config_path=DEFAULT_CONFIG_PATH) | ||
| report, output = manager.validate(image_hash=image_name) |
There was a problem hiding this comment.
nit: The image_name is passed as image_hash. This is a bit confusing because it’s not clear whether we expect an image name (e.g. repo:tag) or an image hash/ID. Could we standardize the terminology end-to-end?
c451fb6 to
63913e9
Compare
| "environment_variables": self._check_environment_variables, | ||
| "python_packages": self._check_python_packages, | ||
| "dependency_health": self._check_dependency_health, | ||
| "vulnerability_scan": self._check_vulnerabilities, |
There was a problem hiding this comment.
Why are we checking for vulnerabilities in the validate script? I thought we decided that the customer will own vuln scanning. If we provide this, it implies we are responsible for catching vulns?
There was a problem hiding this comment.
Thanks for catching up this. I updated the vulnerability check to be the optional check. The default behavior is to skip this check
eb6685d to
57d0cb3
Compare
| @app.command(requires_connection=False) | ||
| def validate( | ||
| image: str = typer.Argument( | ||
| ..., | ||
| help="Local Docker image to validate. Accepts image name (e.g., 'myimage:latest') or image ID/hash.", | ||
| ), | ||
| image_type: str = typer.Option( | ||
| "cpu", | ||
| "--image-type", | ||
| help="Base image type: 'cpu' or 'gpu'. Defaults to 'cpu'.", | ||
| ), | ||
| **options, | ||
| ) -> CommandResult: |
There was a problem hiding this comment.
The function signature accepts **options but never uses them, and critical options shown in the help text (--config and --show-all) are not defined. The test snapshots (test_help_messages.ambr lines 4720-4724) show these options exist in the help output, but they're missing from the actual implementation. This mismatch will confuse users who see the options in help but can't use them.
def validate(
image: str = typer.Argument(...),
image_type: str = typer.Option("cpu", "--image-type", ...),
config: Optional[Path] = typer.Option(None, "--config", "-c", ...),
show_all: bool = typer.Option(False, "--show-all", ...),
) -> CommandResult:Spotted by Graphite
Is this helpful? React 👍 or 👎 to let us know.
There was a problem hiding this comment.
**options this is required in snowflake-cli framework
aa9a75b to
3abf9a8
Compare
There was a problem hiding this comment.
For the whitelisted packages, I hardcoded them here. This is a public repo. We cannot hardcoded the credentials here to access the snowflake-image-builder. This means we should update the whitelist manually. Any concerns or any suggestions @sfc-gh-wesong
There was a problem hiding this comment.
we cannot detect the base image via docker primitives. So we do not have any checks on the base image. And for the image type, GPU or CPU, we rely on users' input. If they do not specify the image type in the command, we will assume that the image is a CPU image
b3ddfe5 to
3f91024
Compare
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
3f91024 to
3e8901b
Compare
Pre-review checklist
Changes description
support configuring the checks in the YAML file
Test report: https://docs.google.com/document/d/1zQWrq62KWWtRlXTkDRZki7A12lLHkoT4w--KJS0ilpg/edit?tab=t.re7qb17krmd4