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

Using CNB buildpacks in builder-classic #298

Closed
ipmb opened this issue Nov 7, 2022 · 2 comments
Closed

Using CNB buildpacks in builder-classic #298

ipmb opened this issue Nov 7, 2022 · 2 comments

Comments

@ipmb
Copy link

ipmb commented Nov 7, 2022

I was surprised to see heroku/builder-classic:22 defaults to the shimmed heroku/nodejs buildpack instead of the CNB one. I use the heroku/python buildpack, so the classic builder is the only option for me currently. AFAICT, there's no way for me to take advantage of the latest heroku/nodejs without looking up the current version on each build. On heroku/buildpacks:20, mixing CNB and shimmed buildpacks worked as expected.

Expected

The latest heroku/nodejs buildpack is selected on both heroku/builder:22 and heroku/builder-classic:22. I expected the classic one to look like this:

$ pack builder inspect heroku/builder:22 --output json | jq '.remote_info.buildpacks[] | select(.id == "heroku/nodejs")'
{
  "id": "heroku/nodejs",
  "name": "Node.js",
  "version": "0.5.11",
  "homepage": "https://github.com/heroku/buildpacks-nodejs"
}

Actual

$ pack builder inspect heroku/builder-classic:22 --output json | jq '.remote_info.buildpacks[] | select(.id == "heroku/nodejs")'
{
  "id": "heroku/nodejs",
  "name": "Node.js",
  "version": "0.0.0"
}

I assumed the classic builder was so you could use shimmed builpacks, not so you could exclude all CNB buildpacks. Is there any reason a user would want to use a shimmed buildpack when CNB exists?

@edmorley
Copy link
Member

edmorley commented Nov 8, 2022

@ipmb Hi again :-)

So this is by design, and is mentioned here:
https://github.com/heroku/builder/blame/8f01e3e6ee5f5e172547b3d1322ec1e52a6abbc8/README.md#L15-L19

The reasoning for this current design is that:

  • we generally try and avoid breaking changes for a specific stack
  • we know there will be breaking changes between the classic shimmed CNBs and their upcoming native CNB replacements (as legacy features/behaviour are dropped + UX improvements introduced)
  • so to avoid future breaking changes for Heroku-22 we've temporarily omitted any languages that don't yet have a native CNB from heroku/builder:22, rather than add a shimmed version and have to swap it out later
  • we also wanted to provide a way for people to get a "close to current Heroku" build experience (which will also give an alternate route for people who need a legacy feature intentionally cut from the new CNBs), which is why the heroku/builder-classic:22 image exists.

If you want to use a shimmed + not shimmed CNB at the same time, you can use --buildpack to specify the buildpacks:

pack build --builder heroku/builder-classic:22 --buildpack urn:cnb:registry:heroku/nodejs --buildpack heroku/python myapp

The urn:cnb:registry syntax refers to this registry listing:
https://registry.buildpacks.io/buildpacks/heroku/nodejs

The docs for the various prefixes supported are here:
https://buildpacks.io/docs/app-developer-guide/specify-buildpacks/#uri-examples

Otherwise, another option would be to continue to use builder heroku/buildpacks:20 and wait until more languages have a native CNB before switching to Heroku-22.

@ipmb
Copy link
Author

ipmb commented Nov 8, 2022

Ah, I wasn't aware of the urn:cnb:registry prefix. That is a reasonable workaround for me until Python gets a proper CNB.

Thanks @edmorley !

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