heroku / cnb-shim

This is a shim to run old buildpacks as Cloud Native Buildpacks
MIT License
1 stars 0 forks source link

Add a deprecation notice #90

Closed edmorley closed 7 months ago

edmorley commented 7 months ago

Heroku's legacy shimmed builder images (heroku/buildpacks:20 and heroku/builder-classic:22) are EOL and will soon stop receiving security updates.

We added deprecation warnings to the builder images back in October: https://github.com/heroku/cnb-builder-images/pull/429

And these warnings were just upgraded to errors: https://github.com/heroku/cnb-builder-images/pull/478

However, the way these warnings/errors are shown is via the builders default buildpack detection group configuration, which means that if a project provides a custom buildpack list (either via project.toml, --buildpack args to Pack CLI, or via a third party build tool that overrides the buildpack list), these warnings aren't shown.

For example, as seen in: https://github.com/apppackio/apppack-codebuild-image/issues/5#issuecomment-2004132334 https://github.com/heroku/buildpacks-nodejs/issues/800#issuecomment-1998654135

As such, I'm adding them directly to cnb-shim, to raise awareness of the Heroku builder image sunset, as well as the deprecated nature of cnb-shim.

The implementation is based on that here: https://github.com/heroku/cnb-builder-images/blob/88cb8159fff129ab498c2e9a5df9bbaff8ea204a/buildpacks-20/end-of-life-buildpack/bin/build

I've re-used the same ALLOW_EOL_SHIMMED_BUILDER env var name, since otherwise it will cause another round of breaking changes for people who've already seen the error message from the builder itself, and have already set that env var.

Since cnb-shim may be being used by non-Heroku builder images too (for which the sunset nature of the builder doesn't apply; only the cnb-shim deprecation), we check the stack ID and vary the message/behaviour accordingly.

GUS-W-15325154.

edmorley commented 7 months ago

Example expected failure using the review app + heroku builder:

heroku builder - env var not set

(pack build --builder heroku/buildpacks:20 --buildpack 'https://cnb-shim-edmorley-depre-mt55fr.herokuapp.com/v1/heroku/python?version=0.0.0&name=Heroku+Python+(Shimmed)' shim-test)

And with ALLOW_EOL_SHIMMED_BUILDER=1:

heroku builder - env var set

(pack build --builder heroku/buildpacks:20 --buildpack 'https://cnb-shim-edmorley-depre-mt55fr.herokuapp.com/v1/heroku/python?version=0.0.0&name=Heroku+Python+(Shimmed)' shim-test -e ALLOW_EOL_SHIMMED_BUILDER=1)

And emulating a non-heroku builder:

non-heroku builder

(pack build --builder heroku/buildpacks:20 --buildpack 'https://cnb-shim-edmorley-depre-mt55fr.herokuapp.com/v1/heroku/python?version=0.0.0&name=Heroku+Python+(Shimmed)' shim-test -e CNB_STACK_ID=another-stack)