buildpacks-community/kpack

Allow using builder image directly in Image like it's possible in Build.

driv opened this issue · 3 comments

I've created a Build and I'm able to execute and push my docker image.

I assumed the next step would be to create an Image and have builds execute when a change appeared. From the docs:

Unlike with the Image resource, using Builds directly allows granular control of when builds execute.

But unlike Build, Image does not allow to just reference a builder by image:

  builder:
    image: paketobuildpacks/builder:base

The minimum I would need to define to have an Image working seems quite far from Build.

Would it be possible to have Image working just like Build but tracking changes?

I don't think we have to much appetite for this change, because it would negate the biggest value-add of the Image resource: the ability to automatically rebase multiple images via a single change in the builder.

The reason the builder is an entire CRD is that on a cluster with many, many images, every single one of them would get rebuilt/rebased if the underlying builder is changed. This can be caused by a change to the ClusterStack, ClusterStore, and/or [Cluster]Buildpacks, and this is only possible because the builder is a CRD that we can model and watch.

If you want something to just watch a git repo and generate new Builds on commit, a CronJob might be a better solution

driv commented

The part is not clear to me from the documentation:
What is the shortest path to be able to use an external builder with Image?

The concept of tracking a change on a builder is great, but can I track changes on a builder created by a third party?

What is the shortest path to be able to use an external builder with Image?

Using kp, pack, and yq:

  1. Create a Buildpack/ClusterBuildpack resource that contains the buildpackages of the builder

    kp buildpack create paketo-builder-jammy-base --image paketobuildpacks/builder-jammy-base
  2. Grab the buildpack ordering off of the image and write it to order.yaml

    pack builder inspect --depth 0 paketobuildpacks/builder-jammy-base -o yaml | yq '.remote_info.detection_order[] | .group = .buildpacks | del(.buildpacks) | [.]'  > order.yaml

    Note: the yq command is a bit unwieldy because kpack uses the key group, but pack uses buildpacks

  3. Create the kpack Builder/ClusterBuilder. This will require write access to my.registry.com/repo/builder

    kp builder create paketo-builder-jammy-base --tag my.registry.com/repo/builder --order order.yaml

The concept of tracking a change on a builder is great, but can I track changes on a builder created by a third party?

Nope, see #1242