Skip to content

Commit 61d43d0

Browse files
committed
fix cli/configuration version
Signed-off-by: Alex Goodman <[email protected]>
1 parent a5e93a0 commit 61d43d0

File tree

7 files changed

+23
-8
lines changed

7 files changed

+23
-8
lines changed

content/docs/reference/grant/cli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ menu_group = "grant"
1111
<!-- AUTO-GENERATED by src/generate_reference_cli_docs.py -- DO NOT MANUALLY EDIT -->
1212

1313
{{< alert title="Note" >}}
14-
This documentation was generated with Grant version `unknown`.
14+
This documentation was generated with Grant version `0.5.0`.
1515
{{< /alert >}}
1616

1717
```

content/docs/reference/grant/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ url = "docs/reference/grant/configuration"
88
menu_group = "grant"
99
+++
1010

11-
<!-- AUTO-GENERATED by scripts/generate_reference_config_docs.py -- DO NOT MANUALLY EDIT -->
11+
<!-- AUTO-GENERATED by src/generate_reference_config_docs.py -- DO NOT MANUALLY EDIT -->
1212

1313
{{< alert title="Note" >}}
1414
This documentation was generated with Grant version `0.5.0`.

content/docs/reference/grype/cli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ menu_group = "grype"
1111
<!-- AUTO-GENERATED by src/generate_reference_cli_docs.py -- DO NOT MANUALLY EDIT -->
1212

1313
{{< alert title="Note" >}}
14-
This documentation was generated with Grype version `unknown`.
14+
This documentation was generated with Grype version `0.103.0`.
1515
{{< /alert >}}
1616

1717
```

content/docs/reference/syft/cli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ menu_group = "syft"
1111
<!-- AUTO-GENERATED by src/generate_reference_cli_docs.py -- DO NOT MANUALLY EDIT -->
1212

1313
{{< alert title="Note" >}}
14-
This documentation was generated with Syft version `unknown`.
14+
This documentation was generated with Syft version `1.37.0`.
1515
{{< /alert >}}
1616

1717
```

src/generate_reference_cli_docs.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,21 @@ def generate_markdown_content(
203203
return content
204204

205205

206+
def get_cache_path(tool_name: str, command_type: str) -> Path:
207+
"""
208+
get cache file path for a command output.
209+
210+
Args:
211+
tool_name: tool name (e.g., "syft", "grype")
212+
command_type: type of command (e.g., "version", "config")
213+
214+
Returns:
215+
Path to cache file
216+
"""
217+
cache_dir = config.paths.reference_cache_dir / tool_name / command_type
218+
return cache_dir / "output.txt"
219+
220+
206221
def get_cache_path_for_cli(tool_name: str, cmd_parts: list[str]) -> Path:
207222
"""
208223
get cache file path for a CLI command output.
@@ -310,10 +325,10 @@ def get_subcommands(image: str, cmd_parts, tool_name: str, update: bool = False)
310325

311326
def get_version_info(image: str, tool_name: str, update: bool = False) -> str:
312327
"""Get version information from the app."""
313-
cache_path = get_cache_path_for_cli(tool_name, ["version"])
328+
cache_path = get_cache_path(tool_name, "version")
314329
app_version = version.get_app_version(image, tool_name, cache_path, update)
315330

316-
if app_version is None:
331+
if app_version is None or app_version == "unknown":
317332
raise RuntimeError(f"Failed to retrieve version info from the image '{image}'.")
318333

319334
return app_version

src/utils/docker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def run_docker_command(
3232
>>> if code == 0:
3333
... print(f"Version: {stdout}")
3434
"""
35-
docker_cmd = ["docker", "run", "--rm", image] + cmd_parts
35+
docker_cmd = ["docker", "run", "--pull", "always", "--rm", image] + cmd_parts
3636

3737
try:
3838
result = subprocess.run(

src/utils/syft.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def run(
4747
>>> # Get config
4848
>>> stdout, stderr, code = syft.run(args=["config"])
4949
"""
50-
docker_cmd = ["docker", "run", "--rm"]
50+
docker_cmd = ["docker", "run", "--pull", "always", "--rm"]
5151

5252
# add environment variables
5353
if env_vars:

0 commit comments

Comments
 (0)