Skip to content

Commit

Permalink
Upgrade legacy builder deprecation warnings to errors
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
edmorley committed Mar 8, 2024
1 parent 45cfffe commit 0cbea37
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 59 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |

Expand Down
54 changes: 27 additions & 27 deletions builder-classic-22/builder.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,109 +59,109 @@ 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"
[[order.group]]
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"
[[order.group]]
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"
[[order.group]]
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"
[[order.group]]
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"
[[order.group]]
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"
[[order.group]]
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"
[[order.group]]
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"
[[order.group]]
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"
[[order.group]]
id = "heroku/procfile"
version = "2.0.2"
optional = true
[[order.group]]
id = "heroku/builder-eol-warning"
version = "1.0.0"
22 changes: 19 additions & 3 deletions builder-classic-22/end-of-life-buildpack/bin/build
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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 <<EOF
#######################################################################
WARNING: This builder image (heroku/builder-classic:22) is deprecated,
${MSG_PREFIX}: This builder image (heroku/builder-classic:22) has been sunset,
since it uses legacy shimmed classic Heroku buildpacks, rather than
Heroku's next-generation Cloud Native Buildpacks.
Expand All @@ -36,8 +50,10 @@ CLI argument, or else change the default builder configuration using:
If you are using a third-party platform to deploy your app, check their
documentation for how to adjust the builder image used for your build.
${MSG_FOOTER}
#######################################################################
EOF
)"

exit 0
exit ${EXIT_CODE}
2 changes: 1 addition & 1 deletion builder-classic-22/end-of-life-buildpack/buildpack.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ api = "0.9"

[buildpack]
id = "heroku/builder-eol-warning"
version = "1.0.0"
version = "2.0.0"
name = "Builder End-of-Life Warning"
homepage = "https://github.com/heroku/cnb-builder-images"

Expand Down
42 changes: 21 additions & 21 deletions buildpacks-20/builder.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,85 +55,85 @@ 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"
[[order.group]]
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"
[[order.group]]
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"
[[order.group]]
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"
[[order.group]]
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"
[[order.group]]
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 = "2.6.6"
[[order.group]]
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 = "4.1.0"
[[order.group]]
id = "heroku/procfile"
version = "2.0.2"
optional = true
[[order.group]]
id = "heroku/builder-eol-warning"
version = "1.0.0"
22 changes: 19 additions & 3 deletions buildpacks-20/end-of-life-buildpack/bin/build
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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 <<EOF
#######################################################################
WARNING: This builder image (heroku/buildpacks:20) is deprecated,
${MSG_PREFIX}: This builder image (heroku/buildpacks:20) has been sunset,
since it uses legacy shimmed classic Heroku buildpacks, rather than
Heroku's next-generation Cloud Native Buildpacks.
Expand All @@ -36,8 +50,10 @@ CLI argument, or else change the default builder configuration using:
If you are using a third-party platform to deploy your app, check their
documentation for how to adjust the builder image used for your build.
${MSG_FOOTER}
#######################################################################
EOF
)"

exit 0
exit ${EXIT_CODE}
2 changes: 1 addition & 1 deletion buildpacks-20/end-of-life-buildpack/buildpack.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ api = "0.9"

[buildpack]
id = "heroku/builder-eol-warning"
version = "1.0.0"
version = "2.0.0"
name = "Builder End-of-Life Warning"
homepage = "https://github.com/heroku/cnb-builder-images"

Expand Down

0 comments on commit 0cbea37

Please sign in to comment.