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

Updated describe command to show layer's digest of each image #622

Merged
merged 4 commits into from
Jan 18, 2024

Conversation

kumaritanushree
Copy link
Contributor

@kumaritanushree kumaritanushree commented Dec 28, 2023

Fixes #348

After this changes output will look like:

$ ./imgpkg describe -b k8slt/kc-e2e-test-repo 
Bundle SHA: sha256:ddd93b67b97c1460580ca1afd04326d16900dc716c4357cade85b83deab76f1c

Images:
  - Image: index.docker.io/k8slt/kctrl-example-pkg@sha256:73713d922b5f561c0db2a7ea5f4f6384f7d2d6289886f8400a8aaf5e8fdf134a
    Type: Bundle
    Origin: index.docker.io/k8slt/kctrl-example-pkg@sha256:73713d922b5f561c0db2a7ea5f4f6384f7d2d6289886f8400a8aaf5e8fdf134a
    Layers:
      - Digest: sha256:dc5da8ac3e06c740dc7d82f9e011ef6927ca9893b5dad7e95650f53ba89445df
    Annotations:
      kbld.carvel.dev/id: k8slt/kctrl-example-pkg:v2.0.0
    Images:
    - Image: index.docker.io/dkalinin/k8s-simple-app@sha256:4c8b96d4fffdfae29258d94a22ae4ad1fe36139d47288b8960d9958d1e63a9d0
      Type: Image
      Origin: index.docker.io/dkalinin/k8s-simple-app@sha256:4c8b96d4fffdfae29258d94a22ae4ad1fe36139d47288b8960d9958d1e63a9d0
      Layers:
        - Digest: sha256:8ece9ac45f2b7228b2ed95e9f407b4f0dc2ac74f93c62ff1156f24c53042ba54
      Annotations:
        kbld.carvel.dev/id: docker.io/dkalinin/k8s-simple-app@sha256:4c8b96d4fffdfae29258d94a22ae4ad1fe36139d47288b8960d9958d1e63a9d0

  - Image: index.docker.io/k8slt/kctrl-example-pkg@sha256:8ffa7f9352149dba1d539d0006b38eda357917edcdd39b82497a61dab2c27b75
    Type: Bundle
    Origin: index.docker.io/k8slt/kctrl-example-pkg@sha256:8ffa7f9352149dba1d539d0006b38eda357917edcdd39b82497a61dab2c27b75
    Layers:
      - Digest: sha256:52bf80eaaecb06062519d66bf59bc8a093cebd37faf48e47fdd79fd009d83612
    Annotations:
      kbld.carvel.dev/id: k8slt/kctrl-example-pkg:v1.0.0
    Images:
    - Image: index.docker.io/dkalinin/k8s-simple-app@sha256:4c8b96d4fffdfae29258d94a22ae4ad1fe36139d47288b8960d9958d1e63a9d0
      Type: Image
      Origin: index.docker.io/dkalinin/k8s-simple-app@sha256:4c8b96d4fffdfae29258d94a22ae4ad1fe36139d47288b8960d9958d1e63a9d0
      Layers:
        - Digest: sha256:8ece9ac45f2b7228b2ed95e9f407b4f0dc2ac74f93c62ff1156f24c53042ba54
      Annotations:
        kbld.carvel.dev/id: docker.io/dkalinin/k8s-simple-app@sha256:4c8b96d4fffdfae29258d94a22ae4ad1fe36139d47288b8960d9958d1e63a9d0

Succeeded

In yaml format:

$ ./imgpkg describe -b k8slt/kc-e2e-test-repo -oyaml
sha: sha256:ddd93b67b97c1460580ca1afd04326d16900dc716c4357cade85b83deab76f1c
content:
  bundles:
    sha256:8ffa7f9352149dba1d539d0006b38eda357917edcdd39b82497a61dab2c27b75:
      annotations:
        kbld.carvel.dev/id: k8slt/kctrl-example-pkg:v1.0.0
      content:
        images:
          sha256:4c8b96d4fffdfae29258d94a22ae4ad1fe36139d47288b8960d9958d1e63a9d0:
            annotations:
              kbld.carvel.dev/id: docker.io/dkalinin/k8s-simple-app@sha256:4c8b96d4fffdfae29258d94a22ae4ad1fe36139d47288b8960d9958d1e63a9d0
            image: index.docker.io/dkalinin/k8s-simple-app@sha256:4c8b96d4fffdfae29258d94a22ae4ad1fe36139d47288b8960d9958d1e63a9d0
            imageType: Image
            layers:
            - digest: sha256:8ece9ac45f2b7228b2ed95e9f407b4f0dc2ac74f93c62ff1156f24c53042ba54
            origin: index.docker.io/dkalinin/k8s-simple-app@sha256:4c8b96d4fffdfae29258d94a22ae4ad1fe36139d47288b8960d9958d1e63a9d0
      image: index.docker.io/k8slt/kctrl-example-pkg@sha256:8ffa7f9352149dba1d539d0006b38eda357917edcdd39b82497a61dab2c27b75
      layers:
      - digest: sha256:52bf80eaaecb06062519d66bf59bc8a093cebd37faf48e47fdd79fd009d83612
      metadata: {}
      origin: index.docker.io/k8slt/kctrl-example-pkg@sha256:8ffa7f9352149dba1d539d0006b38eda357917edcdd39b82497a61dab2c27b75
    sha256:73713d922b5f561c0db2a7ea5f4f6384f7d2d6289886f8400a8aaf5e8fdf134a:
      annotations:
        kbld.carvel.dev/id: k8slt/kctrl-example-pkg:v2.0.0
      content:
        images:
          sha256:4c8b96d4fffdfae29258d94a22ae4ad1fe36139d47288b8960d9958d1e63a9d0:
            annotations:
              kbld.carvel.dev/id: docker.io/dkalinin/k8s-simple-app@sha256:4c8b96d4fffdfae29258d94a22ae4ad1fe36139d47288b8960d9958d1e63a9d0
            image: index.docker.io/dkalinin/k8s-simple-app@sha256:4c8b96d4fffdfae29258d94a22ae4ad1fe36139d47288b8960d9958d1e63a9d0
            imageType: Image
            layers:
            - digest: sha256:8ece9ac45f2b7228b2ed95e9f407b4f0dc2ac74f93c62ff1156f24c53042ba54
            origin: index.docker.io/dkalinin/k8s-simple-app@sha256:4c8b96d4fffdfae29258d94a22ae4ad1fe36139d47288b8960d9958d1e63a9d0
      image: index.docker.io/k8slt/kctrl-example-pkg@sha256:73713d922b5f561c0db2a7ea5f4f6384f7d2d6289886f8400a8aaf5e8fdf134a
      layers:
      - digest: sha256:dc5da8ac3e06c740dc7d82f9e011ef6927ca9893b5dad7e95650f53ba89445df
      metadata: {}
      origin: index.docker.io/k8slt/kctrl-example-pkg@sha256:73713d922b5f561c0db2a7ea5f4f6384f7d2d6289886f8400a8aaf5e8fdf134a
image: index.docker.io/k8slt/kc-e2e-test-repo@sha256:ddd93b67b97c1460580ca1afd04326d16900dc716c4357cade85b83deab76f1c
layers:
- digest: sha256:a18d039a28a58cba06a4aaf435e4479b88daeb3cf7a84e1ca1a5d913f56ad1a8
metadata: {}
origin: index.docker.io/k8slt/kc-e2e-test-repo@sha256:ddd93b67b97c1460580ca1afd04326d16900dc716c4357cade85b83deab76f1c

Succeeded

Signed-off-by: kumari tanushree <ktanushree@vmware.com>
Signed-off-by: kumari tanushree <ktanushree@vmware.com>
Copy link
Member

@praveenrewar praveenrewar left a comment

Choose a reason for hiding this comment

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

Apart from the one small nit, looks good to me.

pkg/imgpkg/v1/describe.go Show resolved Hide resolved
Signed-off-by: kumari tanushree <ktanushree@vmware.com>
Copy link
Member

@joaopapereira joaopapereira left a comment

Choose a reason for hiding this comment

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

After you do the change I proposed in the PR, if all test pass you can merge the PR

@@ -42,6 +42,25 @@ func (i *ImageFactory) ImageDigest(imgRef string) string {
return digest.String()
}

// GetImageLayerDigest will return image's layer digest
func (i *ImageFactory) GetImageLayerDigest(image string) []string {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
func (i *ImageFactory) GetImageLayerDigest(image string) []string {
func (i *ImageFactory) GetFirstLayerDigest(image string) []string {

Copy link
Contributor Author

@kumaritanushree kumaritanushree Jan 17, 2024

Choose a reason for hiding this comment

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

Now we are returning all layers hence will rename it to GetImageLayersDigest. Also image which is used in e2e test has single layers so should work with reading first element of the returned array.

Signed-off-by: kumari tanushree <ktanushree@vmware.com>
Copy link
Member

@joaopapereira joaopapereira left a comment

Choose a reason for hiding this comment

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

LGTM

@kumaritanushree kumaritanushree merged commit e5a7483 into develop Jan 18, 2024
7 checks passed
@praveenrewar praveenrewar deleted the update-describe-cmd branch January 18, 2024 05:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

describe command should provide information about the layers of each Image
4 participants