carvel-dev / kbld

kbld seamlessly incorporates image building and image pushing into your development and deployment workflows
https://carvel.dev/kbld
Apache License 2.0
292 stars 39 forks source link

kbld appends duplicate preresolved origin #206

Open gabegorelick opened 2 years ago

gabegorelick commented 2 years ago

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:

---
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:

If building images using docker: n/a

If building images using buildkit: n/a

If building images using pack


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.

gcheadle-vmware commented 2 years ago

Hi @gabegorelick,

Thank you for pointing out this bug, I agree that the duplicate preresolved origin should probably not be there and could cause confusion. Additionally, in CI we want the same inputs to create the same outputs. For those reasons we agree that kbld should not append duplicate preresolved entries in the origins.

DennisDenuto commented 2 years ago

Hi @gabegorelick

We have merged this PR into develop. Assuming all goes well, expect to see this bug fix in the next kbld release!

ChristianCiach commented 10 months ago

Should this issue be closed? The MR has been merged well over a year ago.