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

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

Open
driv opened this issue Nov 20, 2023 · 3 comments
Open

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

driv opened this issue Nov 20, 2023 · 3 comments

Comments

@driv
Copy link

driv commented Nov 20, 2023

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?

@driv driv changed the title Allow using builder image directly in Images like it's possible in Builds. Allow using builder image directly in Image like it's possible in Build. Nov 20, 2023
@chenbh
Copy link
Contributor

chenbh commented Dec 15, 2023

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
Copy link
Author

driv commented Dec 16, 2023

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?

@chenbh
Copy link
Contributor

chenbh commented Jan 15, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants