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

Add deprecation warnings to legacy builder images #429

Merged
merged 2 commits into from
Oct 30, 2023

Conversation

edmorley
Copy link
Member

@edmorley edmorley commented Oct 27, 2023

Adds deprecation warnings to the heroku/builder-classic:22 and heroku/buildpacks:20 CNB builder images, to raise awareness that they are no longer supported/recommended.

The warnings have been added using a warnings buildpack, similar to the approach used for the Heroku-18 EOL in:
#336

For now these are just warnings, however, in the future will be changed to an error (skippable via env var, like in the PR linked above).

Since these are warnings, the buildpack has been added to the end of each buildpack order group, such that the message is at the end of the overall build log, and so hopefully more visible to end users. (Once the warning is turned into an error, the buildpack should be moved to the start of the order groups, so the build fails early for improved UX.)

A separate mostly-copy-pasted buildpack was used for each builder, since there is no other easy way to customise the message shown for each (and I wanted to include the name of the deprecated builder in the warning message, so users know what image name to grep for).

These buildpacks were written in bash (rather than in Rust, using libcnb.rs), since:

  • the buildpack functionality we need is extremely simple
  • the buildpack is temporary (it will be deleted when we stop updating these builders in the future), so we don't need/want long term published images on CNB registry or to have to set up a Rust compilation/packaging step in this repo.

The buildpacks give zero lint warnings when checked with shellcheck locally.

GUS-W-14194729.
GUS-W-14194736.

@edmorley edmorley self-assigned this Oct 27, 2023
Adds deprecation warnings to the `heroku/builder-classic:22` and
`heroku/buildpacks:20` CNB builder images, to raise awareness that they
are no longer recommended.

The warnings have been added using a warnings buildpack, similar to the
approach used for the Heroku-18 EOL in:
#336

For now these are just warnings, however, in the future will be changed
to an error (skippable via env var, like in the PR linked above).

Since these are warnings, the buildpack has been added to the end of the
order group, such that the message is at the end of the overall build
log, and so hopefully more visible to end users. Once the warning is
turned into an error, the buildpack should be moved to the start of the
order groups, so the build fails early for improved UX.

A separate buildpack was used for each builder, since there is no other
easy way to customise the message shown for each (and I wanted to
include the name of the deprecated builder in the warning message, so
users know what image name to grep for).

These buildpacks were written in bash (rather than in Rust, using
`libcnb.rs`), since:
- the buildpack functionality we need is extremely simple
- the buildpack is temporary (it will be deleted when we stop updating
  these builders in the future), so we don't need/want long term
  published images on CNB registry or to have to set up a Rust
  compilation/packaging step in this repo.

The buildpacks give zero lint warnings when checked with shellcheck
locally.

GUS-W-14194729.
GUS-W-14194736.
@edmorley edmorley force-pushed the edmorley/deprecation-warnings branch from a274bfd to ca9431a Compare October 27, 2023 15:28
@edmorley
Copy link
Member Author

Example warning for heroku/builder-classic:22:
https://github.com/heroku/cnb-builder-images/actions/runs/6669195890/job/18126518745?pr=429#step:6:248

And for heroku/buildpacks:20:
https://github.com/heroku/cnb-builder-images/actions/runs/6669195890/job/18126512300?pr=429#step:6:241

And locally in a console that supports colour:

Console screenshot

@edmorley edmorley marked this pull request as ready for review October 27, 2023 15:39
@edmorley edmorley requested a review from a team as a code owner October 27, 2023 15:39
@edmorley edmorley enabled auto-merge (squash) October 27, 2023 16:01
@dzuelke

This comment was marked as resolved.

@edmorley

This comment was marked as resolved.

@edmorley

This comment was marked as resolved.

@edmorley
Copy link
Member Author

edmorley commented Mar 7, 2024

I plan on upgrading these deprecation warnings to errors (that are skippable with an env var) in the next couple of weeks, in #474.

edmorley added a commit that referenced this pull request Mar 18, 2024
This upgrades the deprecation warnings added in #429 to errors,
for the reasons mentioned in #474.

These errors can be skipped by setting the env var:
`ALLOW_EOL_SHIMMED_BUILDER=1`

For example:

`pack build --env ALLOW_EOL_SHIMMED_BUILDER=1 ...`

However, users are strongly encouraged to migrate from the legacy
shimmed `heroku/buildpacks:20` and `heroku/builder-classic:22`
images to the new `heroku/builder:*` builder images.

For the differences between the available images, see:
https://github.com/heroku/cnb-builder-images#available-images

The buildpack has also been moved to the start of each `[[order]]`
group (rather than the end), so that the build fails early, rather than
wasting the user/build system's time with a build that's only going
to fail. (We had the buildpack at the end of the group before, to
make the EOL warning more visible, since often users won't scroll
back through the logs, and only see what's printed at the end of the
build log in their console.)

Closes #474.
GUS-W-15212520.
edmorley added a commit to heroku/cnb-shim that referenced this pull request Mar 25, 2024
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:
heroku/cnb-builder-images#429

And these warnings were just upgraded to errors:
heroku/cnb-builder-images#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.

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 added a commit that referenced this pull request May 3, 2024
…lassic:22` (#514)

Since these images were:
- superseded by the `heroku/builder:*` images in June 2022
- officially deprecated in Oct 2023 (#429)
- made to error by default in March 2024 (#474)

Builds can still continue using the last version of these builders
published to Docker Hub, and the resultant app images can
still be rebased onto newer run images if needed.

I've also cleaned up the available images table in the README,
to make it display a little better. (There was too much content
before, causing the table to wrap awkwardly when viewed in
the narrow GitHub repo-root view.)

Closes #512.
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

Successfully merging this pull request may close these issues.

3 participants