Skip to content

Fix for ImageId and Repository empty in Container Inventory#1339

Merged
suyadav1 merged 12 commits intoci_prodfrom
suyadav/imageid-repository-empty-fix
Jan 15, 2025
Merged

Fix for ImageId and Repository empty in Container Inventory#1339
suyadav1 merged 12 commits intoci_prodfrom
suyadav/imageid-repository-empty-fix

Conversation

@suyadav1
Copy link
Contributor

@suyadav1 suyadav1 commented Jan 10, 2025

Issue:

There is an issue of missing ImageId and Repository value in some of the records in Container Inventory.

Reason:

ImageId: We were only processing the imageId value when it was of type repo@sha256:imageid but sometimes, the imageId can be of type sha256:imageid. In this scenario, we just need to consider the imageId value as it is.

Repository: We are only relying on the .spec metadata to get the repository value but sometimes the full image name (with repository) is not present in the .spec, as it is coming from default docker.io repository. The repository value in this scenario will be present in the .status metadata.

Fix:

ImageId: Consider the imageId value when it is of type: sha256:imageId as well.

Repository: Try to get the repository value from .status first if possible and fallback to .spec.

Test Notes:

Manually uploaded the ruby files and testes, the changes are working as expected.
[In Progress] Testing with the image generated in the build pipeline.

Screenshots:

Before: ImageId empty
image

After:
image

Before: Repository empty
image

After:
image

@suyadav1 suyadav1 requested a review from a team as a code owner January 10, 2025 22:38
Copy link
Contributor

@ganga1980 ganga1980 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left some comments

@wanlonghenry
Copy link
Contributor

please help attach the screenshot in the PR description for the fixed missing ImageId and Repository

@suyadav1
Copy link
Contributor Author

please help attach the screenshot in the PR description for the fixed missing ImageId and Repository

Added

@suyadav1 suyadav1 closed this Jan 13, 2025
@suyadav1 suyadav1 reopened this Jan 13, 2025
@suyadav1 suyadav1 enabled auto-merge (squash) January 15, 2025 19:44
@suyadav1 suyadav1 merged commit fbc48b6 into ci_prod Jan 15, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants