superfly / flyctl

Command line tools for fly.io services
https://fly.io
Apache License 2.0
1.43k stars 239 forks source link

Migrate away from deprecated `heroku/buildpacks:20` CNB builder image #2964

Open edmorley opened 1 year ago

edmorley commented 1 year ago

Hi 👋

This project uses Heroku's heroku/buildpacks:20 CNB builder image: https://github.com/search?q=repo%3Asuperfly%2Fflyctl%20(heroku%2Fbuilder-classic%20OR%20heroku%2Fbuildpacks)&type=code

We have deprecated this builder image as of https://github.com/heroku/cnb-builder-images/pull/429.

Please migrate to heroku/builder:22 or heroku/builder:20, to continue to receive security updates, and to avoid disruption when the build time deprecation warning is upgraded to an error in the future.

More information on the difference between the various builder images can be seen here: https://github.com/heroku/cnb-builder-images#heroku-cnb-builder-images

edmorley commented 11 months ago

Gentle nudge that builds using these images will start erroring in the future, plus the underlying images themselves will stop receiving security updates.

edmorley commented 10 months ago

@dangra @alichay ^

dangra commented 10 months ago

@edmorley what is the idea? We just switch to heroku/builder:22 and things works the same way or is there some gotcha?

edmorley commented 10 months ago

@dangra The differences between the builder images can be seen in the comparison table linked from the OP. Most notable are the lifecycle version changes (which impact supported Buildpack API versions), and the switch from shimmed classic buildpacks to native CNB buildpacks. Happy to answer any specific questions you have after reading that (if you're not familiar with CNB builder image concepts, I'd check out https://buildpacks.io/docs/concepts/#what-is-a-builder first).

Taking a quick glance at the Heroku builder usages in this repo (using the GitHub code search link in the OP), in general a straight search and replace of heroku/buildpacks:20 for heroku/builder:22 will mostly be fine, with one exception - the scanner/elixir.go usage - since that uses CNB shim which is currently not compatible with newer lifecycle versions (xref https://github.com/heroku/cnb-shim/issues/69). Whilst in the future a new shimming solution might be created (depending on the long tail of classic buildpacks), for now we're prioritising native CNBs (CNBs are still experimental on Heroku, and not in production, so rough edges are to be expected).

Unfortunately no one in the community has yet published a native CNB for Elixir (https://registry.buildpacks.io/searches/elixir), so for now if you want to continue to support that language you'd need to continue to use a builder using an older lifecycle version. I'd still recommend switching the other non-Elixir examples over to heroku/builder:22 now though, to reduce the impact on your users when we stop updating heroku/buildpacks:20.

edmorley commented 8 months ago

Gentle nudge that builds using these images will start erroring in the future, plus the underlying images themselves will stop receiving security updates.

This will be happening within the next couple of weeks in https://github.com/heroku/cnb-builder-images/issues/474. We'll be adding an env var override for the errors, but I strongly recommend you switch from heroku/buildpacks:20 to heroku/builder:* as soon as possible.

edmorley commented 7 months ago

Please migrate to heroku/builder:22 or heroku/builder:20, to continue to receive security updates, and to avoid disruption when the build time deprecation warning is upgraded to an error in the future.

The deprecation warnings were upgraded to errors this morning: https://github.com/heroku/cnb-builder-images/pull/478

edmorley commented 6 months ago

As of yesterday, the legacy heroku/buildpacks:20 and heroku/builder-classic:22 builder images are no longer updated, and so won't receive security updates, fixes or support for new language runtime version releases. Please switch to using the heroku/builder:* images instead: https://github.com/heroku/cnb-builder-images#available-images

uythoang commented 3 months ago

Using heroku/builder:20 now displays warning below, so I I'm trying out heroku/builder:24. So far, so good.

Warning:

This builder image ('heroku/bulder:20') is deprecated, since it is
based on the deprecated 'heroku/heroku:20' base image.

Starting April 30th, 2025, this image will no longer receive security
updates. Shortly after, this builder will be disabled and made
unavailable.

To continue receiving security updates and avoid interruption, upgrade
to one of our newer builders, such as 'heroku/builder:22' or
'heroku/builder:24':
https://github.com/heroku/cnb-builder-images#available-images

If you are using the Pack CLI, you will need to adjust your '--builder'
CLI argument or change the default builder configuration:
https://buildpacks.io/docs/tools/pack/cli/pack_config_default-builder/

If you are using a third-party platform to deploy your app, check the
platform documentation for instructions on changing the builder.
dangra commented 3 months ago

@uythoang if you submit a PR with the required changes and a way to try it myself, I will be more than happy to review and merge the change.

uythoang commented 3 months ago

@dangra There was no code change. This was a configuration change I made to my fly.toml file.

matisnape commented 3 weeks ago

Hey folks, just wanted to add that for me using "heroku/builder:22" or "heroku/builder:24" didn't solve the issue, I get error for the buildpack: [detector] ERROR: failed to set API for Buildpack 'elixir-buildpack/heroku-elixir@0.1': buildpack API version '0.4' is incompatible with the lifecycle

I guess this is not exactly the same thing, but googling led me here so I'm leaving a note for people who might stumble at this, too.

I'm new to Fly.io, I've followed the documentation and went with just fly deploy which added the default buildpacks that don't work. I gave up and switched to Dockerfile instead.