kpack icon indicating copy to clipboard operation
kpack copied to clipboard

Update to support 0.10 of the Buildpack API

Open jwhitcraft opened this issue 1 year ago • 2 comments

Hello,

I recently ran into a problem when trying to use the heroku based buildpacks where one of their buildpacks didn't define a stacks section in the buildpack.toml file. Kpack says that it's not supported,

message: "validating buildpack heroku [email protected]: stack heroku-24 is not supported"

In talking with that team, it seems that kpack neesd to be updated to support 0.10 where stacks are optional/deprecated.

This came out of this discussion here: https://github.com/heroku/buildpacks-procfile/issues/243

For reference here is when the pack cli fixed it: https://github.com/buildpacks/pack/issues/2047

Yaml
apiVersion: kpack.io/v1alpha2
kind: ClusterBuilder
metadata:
  name: heroku-242
spec:
  order:
    - group:
        - id: heroku/nodejs
        - id: heroku/procfile
  serviceAccountRef:
    name: kpack
    namespace: kpack
  stack:
    kind: ClusterStack
    name: heroku-24
  store:
    kind: ClusterStore
    name: heroku-24
  tag: 1231232132.dkr.ecr.us-east-2.amazonaws.com/heroku-24-builder
  additionalLabels:
    io.buildpacks.base.distro.name: "ubuntu"
    io.buildpacks.base.distro.version: "24.04"

---

apiVersion: kpack.io/v1alpha2
kind: ClusterStack
metadata:
  name: heroku-24
spec:
  buildImage:
    image: public.ecr.aws/heroku/builder:24
  id: heroku-24
  runImage:
    image: public.ecr.aws/heroku/heroku:24

---

apiVersion: kpack.io/v1alpha2
kind: ClusterStore
metadata:
  name: heroku-24
spec:
  sources:
    - image: heroku/buildpack-nodejs:3.2.15
    - image: heroku/buildpack-procfile:3.1.2

jwhitcraft avatar Oct 13 '24 20:10 jwhitcraft

This is something we've been meaning to do for a while now and a lot of the work is already in a PR at https://github.com/buildpacks-community/kpack/pull/1332. But I'm not sure if I (or even @natalieparellano) have the capacity to pick it up again right now.

chenbh avatar Oct 17 '24 21:10 chenbh

From what I can tell, the change would need to be made here:

https://github.com/buildpacks-community/kpack/blob/8d8218b9f9fc752848de9c6824a5a3990f380196/pkg/cnb/builder_builder.go#L198

And test updated here (and perhaps in other places):

https://github.com/buildpacks-community/kpack/blob/8d8218b9f9fc752848de9c6824a5a3990f380196/pkg/cnb/create_builder_test.go#L676

As @chenbh mentioned, the team has been stretched a bit thin, so it may take some time for someone to get to this. However this does seem to be a relatively "good first issue" if anyone would like to take it on, I am sure a maintainer would be happy to support.

natalieparellano avatar Oct 24 '24 14:10 natalieparellano

@natalieparellano Hi, my colleagues and I need platform 0.10 and would be open to implement the needed changes in a PR. I see there is an old PR that has it implemented but not merged since there was a regression that is now fixed.

My question is, is the whole thing with the extensions also required that has been added in https://github.com/buildpacks-community/kpack/blob/b14fce92cada91c214661314041b18b1e72ee638/pkg/cnb/builder_builder.go ? Or is it as simple as just adding the 0.9/0.10 version to supportedPlatformApis var?

gajicdev avatar Jan 21 '25 09:01 gajicdev

I created a PR to simply pass the validation if the stacks are empty. As far as I understand there is a whole lot of other stuff to implement to make kpack fully 0.10 compliant (extensions) but this should at least unblock kpack from using some of the more recent heroku ones that do not specify the stacks anymore. I tested the python one and it builds just fine now.

ctrox avatar Feb 06 '25 16:02 ctrox