8000 fix: pass full image identifier to tool.capture by westonsteimel · Pull Request #6 · anchore/yardstick · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: pass full image identifier to tool.capture #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/yardstick/artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class ScanConfiguration(DataClassYAMLMixin):
def __post_init__(self):
self.image_repo = self.image_repo.replace("+", "/")
if not self.tool_input:
self.tool_input = self.image
self.tool_input = self.full_image

@property
def path(self):
Expand All @@ -137,6 +137,13 @@ def tool(self):
def image(self):
return f"{self.image_repo}@{self.image_digest}"

@property
def full_image(self):
if self.image_tag == "":
return self.image

return f"{self.image_repo}:{self.image_tag}@{self.image_digest}"

@property
def image_encoded(self):
return f"{self.image_repo_encoded}@{self.image_digest}"
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/artifact_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def test_scan_configuration():
assert s.image_tag == "stuff"
assert s.tool_name == "grype"
assert s.tool_version == "main"
assert s.tool_input == "docker.io/place/ubuntu@sha256:123"
assert s.tool_input == "docker.io/place/ubuntu:stuff@sha256:123"
assert s.timestamp == datetime.fromisoformat(ts_rfc3339)
assert s.timestamp_rfc3339 == ts_rfc3339
assert s.tool == "grype@main"
Expand Down
0