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

Make Heroku-18 builds fail with a skippable EOL warning #336

Merged
merged 2 commits into from
May 10, 2023

Conversation

edmorley
Copy link
Member

@edmorley edmorley commented May 9, 2023

The Heroku-18 stack reached end-of-life on April 30th 2023, and as of May 1st 2023, builds are no longer possible on the (default) non-CNB Heroku build system, and the underlying stack images will no longer receive security updates (beyond whatever updates Canonical choose to release in May).

However, anyone using the heroku/buildpacks:18 CNB builder image may not realise that it's now EOL and soon to be insecure. They may also not realise that the builder image has moved from the heroku/buildpacks Docker repo to heroku/builder.

In order to raise awareness of both of these, an EOL buildpack has been added, which fails the build with an EOL warning, unless the env var ALLOW_INSECURE_HEROKU_18_BUILDER is set to 1 during the build.

This should affect very few users, since Heroku is not yet using CNBs by default, and Salesforce Functions use the newer heroku/builder:22 builder image instead.

This buildpack was written in bash (rather than in Rust, using libcnb.rs), since:

  • the buildpack functionality we need is extremely simple (checking an env var, printing a message and exiting 1 or 0)
  • the buildpack (and other Heroku-18 related files) are going to be deleted in a few weeks anyway, so its not worth spending time getting a Rust build workflow working with the existing complex GitHub Actions workflow here

GUS-W-13143190.

@edmorley edmorley self-assigned this May 9, 2023
The Heroku-18 stack reached end-of-life on April 30th 2023, and as
of May 1st 2023, builds are no longer possible on the (default) non-CNB
Heroku build system, and the underlying stack images will no longer
 receive security updates (beyond whatever updates Canonical choose to
release in May). 

However, anyone using the `heroku/buildpacks:18` CNB builder image
may not realise that it's now EOL and soon to be insecure. They may also
not realise that the builder image has moved from the `heroku/buildpacks`
Docker repo to `heroku/builder`.

In order to raise awareness of both of these, an EOL buildpack has been
added, which fails the build with an EOL warning, unless the env var
`ALLOW_INSECURE_HEROKU_18_BUILDER` is set during the build.

This should affect very few users, since Heroku is not yet using CNBs by default,
and Salesforce Functions use the `heroku/builder:22` builder image instead.

This buildpack was written in bash, since:
- the buildpack functionality we need is extremely simple (checking an env
  var, printing a message and exiting 1 or 0)
- the buildpack (and other Heroku-18 related files) are going to be deleted
  in a few weeks anyway, so its not worth spending time getting a Rust build
  workflow working with the existing complex GitHub Actions workflow here

GUS-W-13143190.
@edmorley edmorley force-pushed the edmorley/heroku-18-eol-warning branch from fd93929 to 111aba7 Compare May 9, 2023 15:59
@edmorley
Copy link
Member Author

edmorley commented May 9, 2023

Example EOL error when building with heroku/buildpacks:18 and the opt-out env var is not set:

===> BUILDING

Error: This builder image (heroku/buildpacks:18) is based upon the Heroku-18
stack, which has been end-of-life since April 30th, 2023:
https://devcenter.heroku.com/changelog-items/2583

The underlying Ubuntu 18.04 OS is no longer receiving security updates,
and so apps still using it could contain security vulnerabilities.

Please switch to one of our newer 'heroku/builder:*' builder images:
https://github.com/heroku/builder#heroku-builder-images

If you are using the Pack CLI, you will need to adjust the '--builder' CLI
argument, or else change the default builder configuration:
https://buildpacks.io/docs/tools/pack/cli/pack_config_default-builder/


To ignore this error, set the env var ALLOW_INSECURE_HEROKU_18_BUILDER to 1.

ERROR: failed to build: exit status 1

(From: https://github.com/heroku/builder/actions/runs/4927514536/jobs/8804652403?pr=336#step:9:22)

Example successful build with the EOL warning, when ALLOW_INSECURE_HEROKU_18_BUILDER=1:

Warning: This builder image (heroku/buildpacks:18) is based upon the Heroku-18
stack, which has been end-of-life since April 30th, 2023:
https://devcenter.heroku.com/changelog-items/2583

The underlying Ubuntu 18.04 OS is no longer receiving security updates,
and so apps still using it could contain security vulnerabilities.

Please switch to one of our newer 'heroku/builder:*' builder images:
https://github.com/heroku/builder#heroku-builder-images

If you are using the Pack CLI, you will need to adjust the '--builder' CLI
argument, or else change the default builder configuration:
https://buildpacks.io/docs/tools/pack/cli/pack_config_default-builder/

(From: https://github.com/heroku/builder/actions/runs/4927899473/jobs/8805596776#step:9:22)

@edmorley edmorley marked this pull request as ready for review May 9, 2023 16:05
@edmorley edmorley requested a review from a team as a code owner May 9, 2023 16:06
@edmorley edmorley enabled auto-merge (squash) May 10, 2023 09:10
@edmorley edmorley merged commit 185ab91 into main May 10, 2023
@edmorley edmorley deleted the edmorley/heroku-18-eol-warning branch May 10, 2023 09:11
edmorley added a commit that referenced this pull request May 15, 2023
Since:
- The Heroku-18 stack is EOL.
- Builds performed using the `heroku/buildpacks:18` builder already fail with
   an error (unless a skip env var is set), as of #336.
- Whilst there may be an update or two more over the next 2 weeks to the
   underlying stack image, these can be picked up using `pack rebase` even
   without us publishing new versions of the builder image.

GUS-W-13204715.
edmorley added a commit that referenced this pull request Oct 30, 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 each
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.
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.

4 participants