heroku / cnb-shim

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

Allow specifying a custom buildpack `id` #71

Closed edmorley closed 1 year ago

edmorley commented 1 year ago

Previously the buildpack id field in the generated buildpack.toml always had to match the buildpack's full identifier on the buildpack registry (eg heroku/python).

Now, the id in buildpack.toml can be overridden via the id URL parameter.

This is useful in cases where a different ID is preferred for consistency or name conflict reasons, but more importantly will also help work around the issue described here: https://github.com/heroku/builder/pull/335#issuecomment-1533174984

GUS-W-13149987.

edmorley commented 1 year ago

buildpack.toml when id not set in the URL (https://cnb-shim-edmorley-allow-ehvttu.herokuapp.com/v1/heroku/python?version=0.0.0&name=Python):

api = "0.4"

[buildpack]
id = "heroku/python"
version = "0.0.0"
name = "Python"

[[stacks]]
id = "heroku-18"

[[stacks]]
id = "heroku-20"

[[stacks]]
id = "heroku-22"

And when the id is set in the URL (https://cnb-shim-edmorley-allow-ehvttu.herokuapp.com/v1/heroku/python?version=0.0.0&name=Python&id=heroku/python-classic):

api = "0.4"

[buildpack]
id = "heroku/python-classic"
version = "0.0.0"
name = "Python"

[[stacks]]
id = "heroku-18"

[[stacks]]
id = "heroku-20"

[[stacks]]
id = "heroku-22"

And the case we care most about right now - pinning to a version, but keeping the original buildpack ID (https://cnb-shim-edmorley-allow-ehvttu.herokuapp.com/v1/heroku/python-v232?version=0.0.0&name=Python&id=heroku/python):

api = "0.4"

[buildpack]
id = "heroku/python"
version = "0.0.0"
name = "Python"

[[stacks]]
id = "heroku-18"

[[stacks]]
id = "heroku-20"

[[stacks]]
id = "heroku-22"
edmorley commented 1 year ago

Deployed to the production cnb-shim instance just now.