kbld appends duplicate preresolved origin
- Dominant language
- Go
- Stars
- 329
- Forks
- 52
- PR merge metrics
- No merged PRs in 30d
Description
**What steps did you take:**
1. Run `kbld -f foo.yaml --imgpkg-lock-output lock.yaml`
2. Rerun kbld with the resulting ImagesLock file: `kbld -f foo.yaml -f lock.yaml --imgpkg-lock-output lock.yaml`
3. Notice you now have a `preresolved` entry under `kbld.carvel.dev/origins`. So far so good.
4. Run kbld again with the lockfile: `kbld -f foo.yaml -f lock.yaml --imgpkg-lock-output lock.yaml`
5. Notice that the lockfile now has duplicate entries for `preresolved`
**What happened:**
In general, every time you run kbld while passing in the lockfile, kbld will append another `preresolved` entry.
Example:
```yaml
---
apiVersion: imgpkg.carvel.dev/v1alpha1
images:
- annotations:
kbld.carvel.dev/id: fluent/fluent-bit:x86_64-1.7.9
kbld.carvel.dev/origins: |
- resolved:
tag: x86_64-1.7.9
url: fluent/fluent-bit:x86_64-1.7.9
- preresolved:
url: index.docker.io/fluent/fluent-bit@sha256:8e3fdc011d3ff98502143650dfa3261860b11f1f289dbb3184c630f71236a366
- preresolved:
url: index.docker.io/fluent/fluent-bit@sha256:8e3fdc011d3ff98502143650dfa3261860b11f1f289dbb3184c630f71236a366
image: index.docker.io/fluent/fluent-bit@sha256:8e3fdc011d3ff98502143650dfa3261860b11f1f289dbb3184c630f71236a366
kind: ImagesLock
```
**What did you expect:**
Stop after the first addition of `preresolved`.
**Anything else you would like to add:**
https://kubernetes.slack.com/archives/CH8KCCKA5/p1640125213244500?thread_ts=1640041938.237600&cid=CH8KCCKA5
**Environment:**
- kbld version (use `kbld --version`): 0.32.0
- Docker registry used (e.g. `Docker HUB`): n/a
- OS (e.g. from `/etc/os-release`): macOS
If building images using `docker`: n/a
- Docker CLI Version (e.g. `docker version`)
If building images using `buildkit`: n/a
- Buildkit version (e.g. `kubectl buildkit version`):
- Kubernetes version (e.g. `kubectl version`):
If building images using `pack`
- Pack Version (e.g. `pack version`):
---
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 working on this issue.
Contributor guide
Research direction
Reproduce the issue with the listed kbld commands and the generated ImagesLock file, focusing on the --imgpkg-lock-output path and kbld.carvel.dev/origins handling. Trace the CLI entry point for processing lockfiles and inspect existing tests around ImagesLock or preresolved origins if available. Done means rerunning the command leaves only one identical preresolved entry.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100