heroku / cnb-shim

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

Fix the default `name` if none is specified via a URL parameter #70

Closed edmorley closed 1 year ago

edmorley commented 1 year ago

Previously if no &name=... parameter was specified in the URL, then the default buildpack name (the string used for display purposes only, not to be confused by the buildpack id) defaulted to "0.1", which appears to be a copy-paste mistake when the URL handling was added.

Now, if no name is specified, it defaults to the same value as the buildpack id, which will be less pretty in the build logs than a user-provided name (such as "Python"), but at least clearer than "0.1". There are no restrictions on what characters can go in the name (unlike id), so using the id as the name will always be valid: https://github.com/buildpacks/spec/blob/main/buildpack.md#buildpacktoml-toml

No test has been added, since this project currently has zero integration tests of the server component :-( I will test manually using the Review App instead.

GUS-W-12541186.

edmorley commented 1 year ago

The buildpack.toml before (https://cnb-shim.herokuapp.com/v1/heroku/python):

api = "0.4"

[buildpack]
id = "heroku/python"
version = "0.1"
name = "0.1"

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

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

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

And after (https://cnb-shim-edmorley-fix-d-x1vksk.herokuapp.com/v1/heroku/python):

api = "0.4"

[buildpack]
id = "heroku/python"
version = "0.1"
name = "heroku/python"

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

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

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