Skip to content
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

chore: add checks to see if manifest was renamed #6788

Merged
merged 1 commit into from Apr 19, 2024

Conversation

cdrage
Copy link
Contributor

@cdrage cdrage commented Apr 15, 2024

chore: add checks to see if manifest was renamed

What does this PR do?

  • Adds a check to see if a manifest was renamed by analyzing the digests
  • Adds a test for this as well.

Screenshot / video of UI

N/A

What issues does this PR fix or reference?

Closes #6787

How to test this PR?

  • Tests are covering the bug fix or the new feature
  1. Create a manifest (it should not appear in PD)
  2. Rename the manifest podman image tag testmanifest testmanifest123
  3. It should not appear in PD.

Signed-off-by: Charlie Drage charlie@charliedrage.com

@cdrage cdrage requested review from benoitf and a team as code owners April 15, 2024 13:52
@cdrage cdrage requested review from jeffmaury and lstocchi and removed request for a team April 15, 2024 13:52
@@ -39,13 +39,48 @@ const GUESSED_MANIFEST_SIZE = 50 * KB;
//
// We will check this within ImageInfo
export function guessIsManifest(image: ImageInfo, connectionType: string): boolean {
// There is an odd case that if the image has been renamed, we may not be able to safely detect
Copy link
Contributor

Choose a reason for hiding this comment

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

Just wondering why we are not relying on the Names attributes:

C:\Users\Jeff\apps>podman image ls --format json
[
    {
        "Id": "00339ea1c0d1525fd93fc3aa9c926c75ad2ec32a15627c32bd3924a7dbe667cd",
        "ParentId": "",
        "RepoTags": null,
        "RepoDigests": [
            "localhost/mymanifest123@sha256:20b959ad5960230b65a77b746bdbf5d991ade4d7a129c2554e167acdcc990531",
            "localhost/mymanifest@sha256:20b959ad5960230b65a77b746bdbf5d991ade4d7a129c2554e167acdcc990531"
        ],
        "Size": 110,
        "SharedSize": 0,
        "VirtualSize": 110,
        "Labels": null,
        "Containers": 0,
        "Names": [
            "localhost/mymanifest123:latest",
            "localhost/mymanifest:latest"
        ],
        "Digest": "sha256:20b959ad5960230b65a77b746bdbf5d991ade4d7a129c2554e167acdcc990531",
        "History": [
            "localhost/mymanifest:latest",
            "localhost/mymanifest123:latest"
        ],
        "Created": 1713253600,
        "CreatedAt": "2024-04-16T07:46:40Z"
    },

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi! We do not use names as they can still be changed and do not contain the digest value. We use digests to more accurate detect if it's been renamed or not.

Copy link
Contributor

@lstocchi lstocchi left a comment

Choose a reason for hiding this comment

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

Tested and worked fine

@cdrage cdrage force-pushed the modify-is-manifest branch 2 times, most recently from 11692c7 to 39958a6 Compare April 19, 2024 12:28
### What does this PR do?

* Adds a check to see if a manifest was renamed by analyzing the digests
* Adds a test for this as well.

### Screenshot / video of UI

<!-- If this PR is changing UI, please include
screenshots or screencasts showing the difference -->

N/A

### What issues does this PR fix or reference?

<!-- Include any related issues from Podman Desktop
repository (or from another issue tracker). -->

Closes containers#6787

### How to test this PR?

<!-- Please explain steps to verify the functionality,
do not forget to provide unit/component tests -->

- [X] Tests are covering the bug fix or the new feature

1. Create a manifest (it should not appear in PD)
2. Rename the manifest `podman image tag testmanifest testmanifest123`
3. It should **not** appear in PD.

Signed-off-by: Charlie Drage <charlie@charliedrage.com>
Copy link
Contributor

@axel7083 axel7083 left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@cdrage cdrage merged commit 0a47d08 into containers:main Apr 19, 2024
8 checks passed
@podman-desktop-bot podman-desktop-bot added this to the 1.10.0 milestone Apr 19, 2024
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.

Manifests appear in Podman Desktop if you rename them
5 participants