carvel-dev / carvel-dev/imgpkg

Plain text output of describe command look incorrect

Open
#346 0 comments 0 reactions 0 assignees View on GitHub
bug carvel accepted good first issue
Dominant language
Go
Stars
284
Forks
70
PR merge metrics
No merged PRs in 30d

Description

**What steps did you take:**
When the annotation in ImagesLock contains yaml the text output of the describe command is incorrectly indented.

Let us assume we have the following ImagesLock
```yaml
---
apiVersion: imgpkg.carvel.dev/v1alpha1
images:
- annotations:
kbld.carvel.dev/id: index.docker.io/dkalinin/k8s-simple-app:latest
kbld.carvel.dev/origins: |
- resolved:
tag: latest
url: index.docker.io/dkalinin/k8s-simple-app:latest
image: index.docker.io/dkalinin/k8s-simple-app@sha256:4c8b96d4fffdfae29258d94a22ae4ad1fe36139d47288b8960d9958d1e63a9d0
kind: ImagesLock
```

When we execute `imgpkg push -b localhost:5000/test -f basic-step-2` the bundle is pushed to the registry

**What happened:**

When we execute `imgpkg describe -b localhost:5000/test@sha256:3cd8f0d917a92fafeef2d44eb63195d5351c35cf46b8b7448cb126c7d68c6291` this is the output

```
Bundle SHA: sha256:3cd8f0d917a92fafeef2d44eb63195d5351c35cf46b8b7448cb126c7d68c6291

Images:
- Image: index.docker.io/dkalinin/k8s-simple-app@sha256:4c8b96d4fffdfae29258d94a22ae4ad1fe36139d47288b8960d9958d1e63a9d0
Type: Image
Origin: index.docker.io/dkalinin/k8s-simple-app@sha256:4c8b96d4fffdfae29258d94a22ae4ad1fe36139d47288b8960d9958d1e63a9d0
Annotations:
kbld.carvel.dev/id: index.docker.io/dkalinin/k8s-simple-app:latest
kbld.carvel.dev/origins: - resolved:
tag: latest
url: index.docker.io/dkalinin/k8s-simple-app:latest

Succeeded
```

**What did you expect:**
The output should be correctly indented
```
Bundle SHA: sha256:3cd8f0d917a92fafeef2d44eb63195d5351c35cf46b8b7448cb126c7d68c6291

Images:
- Image: index.docker.io/dkalinin/k8s-simple-app@sha256:4c8b96d4fffdfae29258d94a22ae4ad1fe36139d47288b8960d9958d1e63a9d0
Type: Image
Origin: index.docker.io/dkalinin/k8s-simple-app@sha256:4c8b96d4fffdfae29258d94a22ae4ad1fe36139d47288b8960d9958d1e63a9d0
Annotations:
kbld.carvel.dev/id: index.docker.io/dkalinin/k8s-simple-app:latest
kbld.carvel.dev/origins: - resolved:
tag: latest
url: index.docker.io/dkalinin/k8s-simple-app:latest

Succeeded
```

**Anything else you would like to add:**
We are using the IndentingUI to automatically indent our output but maybe in this case we need to use some static Prefix or something similar

**Environment:**

- imgpkg version (use `imgpkg --version`): v0.26.0
- Docker registry used (e.g. `Docker HUB`): NA
- OS (e.g. from `/etc/os-release`): MacOS

---
Vote on this request

This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.

👍 "I would like to see this addressed as soon as possible"
👎 "There are other more important things to focus on right now"

We are also happy to receive and review Pull Requests if you want to help work on this issue.

Contributor guide

Open the contributing guide

Research direction

Start with the imgpkg describe command and reproduce the output using the ImagesLock example containing the multiline kbld.carvel.dev/origins annotation. Trace how annotation text is rendered with IndentingUI, then verify that the nested tag and url lines are aligned as shown in the expected output.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.