From 0cbea37c594c9f0da7b880133c282b5fca1e5779 Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Fri, 8 Mar 2024 12:14:02 +0000 Subject: [PATCH] Upgrade legacy builder deprecation warnings to errors 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. --- README.md | 6 +-- builder-classic-22/builder.toml | 54 +++++++++---------- .../end-of-life-buildpack/bin/build | 22 ++++++-- .../end-of-life-buildpack/buildpack.toml | 2 +- buildpacks-20/builder.toml | 42 +++++++-------- buildpacks-20/end-of-life-buildpack/bin/build | 22 ++++++-- .../end-of-life-buildpack/buildpack.toml | 2 +- 7 files changed, 91 insertions(+), 59 deletions(-) diff --git a/README.md b/README.md index 941d5538..3559d745 100644 --- a/README.md +++ b/README.md @@ -17,15 +17,15 @@ For more information, see: [What is a builder?](https://buildpacks.io/docs/conce ## Available images > [!WARNING] -> The `heroku/buildpacks:*` and `heroku/builder-classic:*` builder image variants are deprecated, +> The `heroku/buildpacks:*` and `heroku/builder-classic:*` builder image variants have been sunset, > since they use classic Heroku buildpacks shimmed for compatibility with the CNB specification, > rather than Heroku's next-generation Cloud Native Buildpacks. | Builder Image | Base Build Image | Base Run Image | Lifecycle Version | Buildpack Types | Status | |-----------------------------------------------------|---------------------------------------------|---------------------------------------|-------------------|------------------|-------------| | [`heroku/buildpacks:18`][buildpacks-tags] | [`heroku/heroku:18-cnb-build`][heroku-tags] | [`heroku/heroku:18-cnb`][heroku-tags] | 0.16.1 | Shimmed + Native | End-of-life | -| [`heroku/buildpacks:20`][buildpacks-tags] | [`heroku/heroku:20-cnb-build`][heroku-tags] | [`heroku/heroku:20-cnb`][heroku-tags] | 0.17.4 | Shimmed + Native | Deprecated | -| [`heroku/builder-classic:22`][builder-classic-tags] | [`heroku/heroku:22-cnb-build`][heroku-tags] | [`heroku/heroku:22-cnb`][heroku-tags] | 0.17.4 | Shimmed | Deprecated | +| [`heroku/buildpacks:20`][buildpacks-tags] | [`heroku/heroku:20-cnb-build`][heroku-tags] | [`heroku/heroku:20-cnb`][heroku-tags] | 0.17.4 | Shimmed + Native | End-of-life | +| [`heroku/builder-classic:22`][builder-classic-tags] | [`heroku/heroku:22-cnb-build`][heroku-tags] | [`heroku/heroku:22-cnb`][heroku-tags] | 0.17.4 | Shimmed | End-of-life | | [`heroku/builder:20`][builder-tags] | [`heroku/heroku:20-cnb-build`][heroku-tags] | [`heroku/heroku:20-cnb`][heroku-tags] | 0.19.0 | Native | Available | | [`heroku/builder:22`][builder-tags] | [`heroku/heroku:22-cnb-build`][heroku-tags] | [`heroku/heroku:22-cnb`][heroku-tags] | 0.19.0 | Native | Recommended | diff --git a/builder-classic-22/builder.toml b/builder-classic-22/builder.toml index e379127f..3a67f502 100644 --- a/builder-classic-22/builder.toml +++ b/builder-classic-22/builder.toml @@ -59,6 +59,9 @@ version = "0.17.4" uri = "https://cnb-shim.herokuapp.com/v1/heroku/scala?version=0.0.0&name=Heroku+Scala+(Shimmed)" [[order]] + [[order.group]] + id = "heroku/builder-eol-warning" + version = "2.0.0" [[order.group]] id = "heroku/ruby" version = "0.0.0" @@ -66,11 +69,11 @@ version = "0.17.4" id = "heroku/procfile" version = "2.0.2" optional = true - [[order.group]] - id = "heroku/builder-eol-warning" - version = "1.0.0" [[order]] + [[order.group]] + id = "heroku/builder-eol-warning" + version = "2.0.0" [[order.group]] id = "heroku/clojure" version = "0.0.0" @@ -78,11 +81,11 @@ version = "0.17.4" id = "heroku/procfile" version = "2.0.2" optional = true - [[order.group]] - id = "heroku/builder-eol-warning" - version = "1.0.0" [[order]] + [[order.group]] + id = "heroku/builder-eol-warning" + version = "2.0.0" [[order.group]] id = "heroku/python" version = "0.0.0" @@ -90,11 +93,11 @@ version = "0.17.4" id = "heroku/procfile" version = "2.0.2" optional = true - [[order.group]] - id = "heroku/builder-eol-warning" - version = "1.0.0" [[order]] + [[order.group]] + id = "heroku/builder-eol-warning" + version = "2.0.0" [[order.group]] id = "heroku/java" version = "0.0.0" @@ -102,11 +105,11 @@ version = "0.17.4" id = "heroku/procfile" version = "2.0.2" optional = true - [[order.group]] - id = "heroku/builder-eol-warning" - version = "1.0.0" [[order]] + [[order.group]] + id = "heroku/builder-eol-warning" + version = "2.0.0" [[order.group]] id = "heroku/gradle" version = "0.0.0" @@ -114,11 +117,11 @@ version = "0.17.4" id = "heroku/procfile" version = "2.0.2" optional = true - [[order.group]] - id = "heroku/builder-eol-warning" - version = "1.0.0" [[order]] + [[order.group]] + id = "heroku/builder-eol-warning" + version = "2.0.0" [[order.group]] id = "heroku/scala" version = "0.0.0" @@ -126,11 +129,11 @@ version = "0.17.4" id = "heroku/procfile" version = "2.0.2" optional = true - [[order.group]] - id = "heroku/builder-eol-warning" - version = "1.0.0" [[order]] + [[order.group]] + id = "heroku/builder-eol-warning" + version = "2.0.0" [[order.group]] id = "heroku/php" version = "0.0.0" @@ -138,11 +141,11 @@ version = "0.17.4" id = "heroku/procfile" version = "2.0.2" optional = true - [[order.group]] - id = "heroku/builder-eol-warning" - version = "1.0.0" [[order]] + [[order.group]] + id = "heroku/builder-eol-warning" + version = "2.0.0" [[order.group]] id = "heroku/go" version = "0.0.0" @@ -150,11 +153,11 @@ version = "0.17.4" id = "heroku/procfile" version = "2.0.2" optional = true - [[order.group]] - id = "heroku/builder-eol-warning" - version = "1.0.0" [[order]] + [[order.group]] + id = "heroku/builder-eol-warning" + version = "2.0.0" [[order.group]] id = "heroku/nodejs" version = "0.0.0" @@ -162,6 +165,3 @@ version = "0.17.4" id = "heroku/procfile" version = "2.0.2" optional = true - [[order.group]] - id = "heroku/builder-eol-warning" - version = "1.0.0" diff --git a/builder-classic-22/end-of-life-buildpack/bin/build b/builder-classic-22/end-of-life-buildpack/bin/build index 8f61a62e..33e84223 100755 --- a/builder-classic-22/end-of-life-buildpack/bin/build +++ b/builder-classic-22/end-of-life-buildpack/bin/build @@ -2,6 +2,10 @@ set -euo pipefail +ENV_DIR="${2}/env" +ENV_VAR_NAME='ALLOW_EOL_SHIMMED_BUILDER' +ALLOW_BUILD="$(cat "${ENV_DIR}/${ENV_VAR_NAME}" 2> /dev/null || true)" + ANSI_RED="\033[1;31m" ANSI_RESET="\033[0m" @@ -15,10 +19,20 @@ function display_error() { echo >&2 } -display_error "$(cat <<'EOF' +if [[ "${ALLOW_BUILD}" == "1" ]]; then + MSG_PREFIX="WARNING" + MSG_FOOTER="Allowing the build to continue since ${ENV_VAR_NAME} is set." + EXIT_CODE=0 +else + MSG_PREFIX="ERROR" + MSG_FOOTER="To ignore this error, set the env var ${ENV_VAR_NAME} to 1." + EXIT_CODE=1 +fi + +display_error "$(cat < /dev/null || true)" + ANSI_RED="\033[1;31m" ANSI_RESET="\033[0m" @@ -15,10 +19,20 @@ function display_error() { echo >&2 } -display_error "$(cat <<'EOF' +if [[ "${ALLOW_BUILD}" == "1" ]]; then + MSG_PREFIX="WARNING" + MSG_FOOTER="Allowing the build to continue since ${ENV_VAR_NAME} is set." + EXIT_CODE=0 +else + MSG_PREFIX="ERROR" + MSG_FOOTER="To ignore this error, set the env var ${ENV_VAR_NAME} to 1." + EXIT_CODE=1 +fi + +display_error "$(cat <