Skip to content

Commit

Permalink
Remove support for Heroku-18 (#1449)
Browse files Browse the repository at this point in the history
Since the Heroku-18 stack has reached end-of-life, and as such build using it
are no longer supported by the Heroku build system:
https://devcenter.heroku.com/changelog-items/2583

This fixes the integration tests failing in CI for the Heroku-18 stack, due to the
build system now (as expected) rejecting the jobs, eg:
https://github.com/heroku/heroku-buildpack-python/actions/runs/4852163562/jobs/8646809603?pr=1448#step:5:165

The Heroku-18 stack was the last to have Python binaries available for Python 2.7,
3.5 and 3.5, so the EOL conditionals and testcases for those versions have now been
removed.

Any non-Heroku consumers of this buildpack that wish to continue using
the Heroku-18 stack should pin to the previous version of this buildpack.

GUS-W-10446293.
  • Loading branch information
edmorley committed May 3, 2023
1 parent 7576b17 commit d215801
Show file tree
Hide file tree
Showing 19 changed files with 41 additions and 323 deletions.
15 changes: 0 additions & 15 deletions .github/workflows/build_python_runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,6 @@ env:
# Unfortunately these jobs cannot be easily written as a matrix since `matrix.exclude` does not
# support expression syntax, and the `inputs` context is not available inside the job `if` key.
jobs:
build-and-upload-heroku-18:
runs-on: pub-hk-ubuntu-22.04-xlarge
env:
STACK_VERSION: "18"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build Docker image
run: docker build --pull --tag buildenv --build-arg=STACK_VERSION builds/
- name: Build and package Python runtime
run: docker run --rm --platform="linux/amd64" --volume="${PWD}/upload:/tmp/upload" buildenv ./build_python_runtime.sh "${{ inputs.python_version }}"
- name: Upload Python runtime archive to S3
if: (!inputs.dry_run)
run: aws s3 sync ./upload "s3://${S3_BUCKET}"

build-and-upload-heroku-20:
runs-on: pub-hk-ubuntu-22.04-xlarge
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
strategy:
fail-fast: false
matrix:
stack: ["heroku-18", "heroku-20", "heroku-22"]
stack: ["heroku-20", "heroku-22"]
env:
HATCHET_APP_LIMIT: 200
HATCHET_DEFAULT_STACK: ${{ matrix.stack }}
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased

- Remove support for Heroku-18. ([#1449](https://github.com/heroku/heroku-buildpack-python/pull/1449))

## v232 (2023-04-27)

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@ Supported runtime options include:
- `python-3.11.3` on all [supported stacks](https://devcenter.heroku.com/articles/stack#stack-support-details)
- `python-3.10.11` on all [supported stacks](https://devcenter.heroku.com/articles/stack#stack-support-details)
- `python-3.9.16` on all [supported stacks](https://devcenter.heroku.com/articles/stack#stack-support-details)
- `python-3.8.16` on Heroku-18 and Heroku-20 only
- `python-3.7.16` on Heroku-18 and Heroku-20 only
- `python-3.8.16` on Heroku-20 only
- `python-3.7.16` on Heroku-20 only
29 changes: 0 additions & 29 deletions bin/steps/python
Original file line number Diff line number Diff line change
Expand Up @@ -71,35 +71,6 @@ case "${PYTHON_VERSION}" in
python-3.6.*)
eol_python_version_error "3.6" "December 23rd, 2021"
;;
python-3.5.*)
eol_python_version_error "3.5" "September 30th, 2020"
;;
python-3.4.*)
eol_python_version_error "3.4" "March 18th, 2019"
;;
python-2.7.*)
puts-warn
puts-warn "Python 2 reached upstream end-of-life on January 1st, 2020, and is"
puts-warn "therefore no longer receiving security updates. Apps still using it"
puts-warn "contain potential security vulnerabilities and should be upgraded to"
puts-warn "Python 3 as soon as possible."
puts-warn
puts-warn "In addition, Python 2 is only supported on our oldest stack, Heroku-18,"
puts-warn "which is deprecated and reaches end-of-life on April 30th, 2023."
puts-warn
puts-warn "As such, it is no longer supported by the latest version of this buildpack:"
puts-warn "https://devcenter.heroku.com/changelog-items/2473"
puts-warn
puts-warn "You must either:"
puts-warn " - Upgrade to Python 3 (recommended)"
puts-warn " - Switch to the container stack and use the upstream legacy 'python:2.7' Docker images"
puts-warn " - Switch to an older version of the Python buildpack (short term workaround only)"
puts-warn
puts-warn "For more details, see:"
puts-warn "https://devcenter.heroku.com/articles/python-2-7-eol-faq"
puts-warn
exit 1
;;
pypy*)
puts-warn
puts-warn "PyPy is no longer supported by the latest version of this buildpack."
Expand Down
37 changes: 28 additions & 9 deletions builds/build_python_runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,31 @@ INSTALL_DIR="/app/.heroku/python"
SRC_DIR="/tmp/src"
ARCHIVES_DIR="/tmp/upload/${STACK}/runtimes"

echo "Building Python ${PYTHON_VERSION} for ${STACK}..."
case "${STACK}" in
heroku-22)
SUPPORTED_PYTHON_VERSIONS=(
"3.9"
"3.10"
"3.11"
)
;;
heroku-20)
SUPPORTED_PYTHON_VERSIONS=(
"3.7"
"3.8"
"3.9"
"3.10"
"3.11"
)
;;
*)
echo "Error: Unsupported stack '${STACK}'!" >&2
exit 1
;;
esac

if [[ "${STACK}" != "heroku-18" && "${STACK}" != "heroku-20" && "${PYTHON_MAJOR_VERSION}" == 3.[7-8] ]]; then
echo "Error: Python ${PYTHON_MAJOR_VERSION} is only supported on Heroku-20 and older!" >&2
if [[ ! " ${SUPPORTED_PYTHON_VERSIONS[*]} " == *" ${PYTHON_MAJOR_VERSION} "* ]]; then
echo "Error: Python ${PYTHON_MAJOR_VERSION} is not supported on ${STACK}!" >&2
exit 1
fi

Expand All @@ -36,6 +57,8 @@ case "${PYTHON_MAJOR_VERSION}" in
;;
esac

echo "Building Python ${PYTHON_VERSION} for ${STACK}..."

SOURCE_URL="https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz"
SIGNATURE_URL="${SOURCE_URL}.asc"

Expand All @@ -46,12 +69,8 @@ mkdir -p "${SRC_DIR}" "${INSTALL_DIR}" "${ARCHIVES_DIR}"
curl --fail --retry 3 --retry-connrefused --connect-timeout 10 --max-time 60 -o python.tgz "${SOURCE_URL}"
curl --fail --retry 3 --retry-connrefused --connect-timeout 10 --max-time 60 -o python.tgz.asc "${SIGNATURE_URL}"

# Skip GPG verification on Heroku-18 since it fails to fetch keys:
# `gpg: keyserver receive failed: Server indicated a failure`
if [[ "${STACK}" != "heroku-18" ]]; then
gpg --batch --verbose --recv-keys "${GPG_KEY_FINGERPRINT}"
gpg --batch --verify python.tgz.asc python.tgz
fi
gpg --batch --verbose --recv-keys "${GPG_KEY_FINGERPRINT}"
gpg --batch --verify python.tgz.asc python.tgz

tar --extract --file python.tgz --strip-components=1 --directory "${SRC_DIR}"
cd "${SRC_DIR}"
Expand Down
12 changes: 0 additions & 12 deletions spec/fixtures/pipenv_python_2.7/Pipfile

This file was deleted.

29 changes: 0 additions & 29 deletions spec/fixtures/pipenv_python_2.7/Pipfile.lock

This file was deleted.

12 changes: 0 additions & 12 deletions spec/fixtures/pipenv_python_3.5/Pipfile

This file was deleted.

29 changes: 0 additions & 29 deletions spec/fixtures/pipenv_python_3.5/Pipfile.lock

This file was deleted.

1 change: 0 additions & 1 deletion spec/fixtures/python_2.7/requirements.txt

This file was deleted.

1 change: 0 additions & 1 deletion spec/fixtures/python_2.7/runtime.txt

This file was deleted.

1 change: 0 additions & 1 deletion spec/fixtures/python_3.4/requirements.txt

This file was deleted.

1 change: 0 additions & 1 deletion spec/fixtures/python_3.4/runtime.txt

This file was deleted.

1 change: 0 additions & 1 deletion spec/fixtures/python_3.5/requirements.txt

This file was deleted.

1 change: 0 additions & 1 deletion spec/fixtures/python_3.5/runtime.txt

This file was deleted.

76 changes: 3 additions & 73 deletions spec/hatchet/pipenv_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,80 +73,10 @@
end
end

context 'with a Pipfile.lock containing python_version 2.7' do
let(:app) { Hatchet::Runner.new('spec/fixtures/pipenv_python_2.7', allow_failure: true) }

context 'when using Heroku-18', stacks: %w[heroku-18] do
it 'aborts the build with an EOL message' do
app.deploy do |app|
expect(clean_output(app.output)).to include(<<~OUTPUT)
remote: -----> Python app detected
remote: -----> Using Python version specified in Pipfile.lock
remote: !
remote: ! Python 2 reached upstream end-of-life on January 1st, 2020, and is
remote: ! therefore no longer receiving security updates. Apps still using it
remote: ! contain potential security vulnerabilities and should be upgraded to
remote: ! Python 3 as soon as possible.
remote: !
remote: ! In addition, Python 2 is only supported on our oldest stack, Heroku-18,
remote: ! which is deprecated and reaches end-of-life on April 30th, 2023.
remote: !
remote: ! As such, it is no longer supported by the latest version of this buildpack:
remote: ! https://devcenter.heroku.com/changelog-items/2473
remote: !
remote: ! You must either:
remote: ! - Upgrade to Python 3 (recommended)
remote: ! - Switch to the container stack and use the upstream legacy 'python:2.7' Docker images
remote: ! - Switch to an older version of the Python buildpack (short term workaround only)
remote: !
remote: ! For more details, see:
remote: ! https://devcenter.heroku.com/articles/python-2-7-eol-faq
remote: !
OUTPUT
end
end
end

context 'when using Heroku-20 or newer', stacks: %w[heroku-20 heroku-22] do
# Python 2.7 is EOL, so has not been built for newer stacks.
include_examples 'aborts the build with a runtime not available message (Pipenv)', '2.7.18'
end
end

context 'with a Pipfile.lock containing python_version 3.5' do
let(:app) { Hatchet::Runner.new('spec/fixtures/pipenv_python_3.5', allow_failure: true) }

context 'when using Heroku-18', stacks: %w[heroku-18] do
it 'aborts the build with an EOL message' do
app.deploy do |app|
expect(clean_output(app.output)).to include(<<~OUTPUT)
remote: -----> Python app detected
remote: -----> Using Python version specified in Pipfile.lock
remote: !
remote: ! Python 3.5 reached upstream end-of-life on September 30th, 2020, and is
remote: ! therefore no longer receiving security updates:
remote: ! https://devguide.python.org/versions/#supported-versions
remote: !
remote: ! As such, it is no longer supported by the latest version of this buildpack.
remote: !
remote: ! Please upgrade to a newer Python version. See:
remote: ! https://devcenter.heroku.com/articles/python-runtimes
remote: !
OUTPUT
end
end
end

context 'when using Heroku-20 or newer', stacks: %w[heroku-20 heroku-22] do
# Python 3.5 is EOL, so has not been built for newer stacks.
include_examples 'aborts the build with a runtime not available message (Pipenv)', '3.5.10'
end
end

context 'with a Pipfile.lock containing python_version 3.6' do
let(:app) { Hatchet::Runner.new('spec/fixtures/pipenv_python_3.6', allow_failure: true) }

context 'when using Heroku-18 or Heroku-20', stacks: %w[heroku-18 heroku-20] do
context 'when using Heroku-20', stacks: %w[heroku-20] do
it 'aborts the build with an EOL message' do
app.deploy do |app|
expect(clean_output(app.output)).to match(Regexp.new(<<~OUTPUT))
Expand Down Expand Up @@ -177,7 +107,7 @@
let(:allow_failure) { false }
let(:app) { Hatchet::Runner.new('spec/fixtures/pipenv_python_3.7', allow_failure:) }

context 'when using Heroku-18 or Heroku-20', stacks: %w[heroku-18 heroku-20] do
context 'when using Heroku-20', stacks: %w[heroku-20] do
it 'builds with the latest Python 3.7 but shows a deprecation warning' do
app.deploy do |app|
expect(clean_output(app.output)).to match(Regexp.new(<<~REGEX))
Expand Down Expand Up @@ -213,7 +143,7 @@
let(:allow_failure) { false }
let(:app) { Hatchet::Runner.new('spec/fixtures/pipenv_python_3.8', allow_failure:) }

context 'when using Heroku-18 or Heroku-20', stacks: %w[heroku-18 heroku-20] do
context 'when using Heroku-20', stacks: %w[heroku-20] do
include_examples 'builds using Pipenv with the requested Python version', LATEST_PYTHON_3_8
end

Expand Down
4 changes: 2 additions & 2 deletions spec/hatchet/python_update_warning_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
let(:allow_failure) { false }
let(:app) { Hatchet::Runner.new('spec/fixtures/python_3.7_outdated', allow_failure:) }

context 'when using Heroku-18 or Heroku-20', stacks: %w[heroku-18 heroku-20] do
context 'when using Heroku-20', stacks: %w[heroku-20] do
it 'warns about both the deprecated major version and the patch update' do
app.deploy do |app|
expect(clean_output(app.output)).to match(Regexp.new(<<~REGEX))
Expand Down Expand Up @@ -95,7 +95,7 @@
let(:allow_failure) { false }
let(:app) { Hatchet::Runner.new('spec/fixtures/python_3.8_outdated', allow_failure:) }

context 'when using Heroku-18 or Heroku-20', stacks: %w[heroku-18 heroku-20] do
context 'when using Heroku-20', stacks: %w[heroku-20] do
include_examples 'warns there is a Python update available', '3.8.12', LATEST_PYTHON_3_8
end

Expand Down
Loading

0 comments on commit d215801

Please sign in to comment.