Fix for ImageId and Repository empty in Container Inventory#1339
Merged
Fix for ImageId and Repository empty in Container Inventory#1339
Conversation
suyadav1
commented
Jan 10, 2025
ganga1980
reviewed
Jan 11, 2025
ganga1980
reviewed
Jan 11, 2025
ganga1980
reviewed
Jan 11, 2025
Contributor
|
please help attach the screenshot in the PR description for the fixed missing ImageId and Repository |
Contributor
Author
Added |
ganga1980
approved these changes
Jan 14, 2025
wanlonghenry
approved these changes
Jan 15, 2025
* remove rexml in win * update to remove rexml by force as all dependency are for development
This reverts commit 660cd67.
….com/microsoft/Docker-Provider into suyadav/imageid-repository-empty-fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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

After:

Before: Repository empty

After:
