Skip to content

Commit e838173

Browse files
devops: sync up with upstream as of 8/28/24
COMPT-3417 merge latest upstream as of 8/28/24
2 parents e8a5a8e + ddb3a52 commit e838173

File tree

100 files changed

+1679
-997
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+1679
-997
lines changed

.github/workflows/build_python_runtime.yml

Lines changed: 62 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,21 @@ on:
55
workflow_dispatch:
66
inputs:
77
python_version:
8-
description: "The Python version to build, specified as X.Y.Z"
8+
description: "Python version (eg: 3.12.0)"
99
type: string
1010
required: true
11+
stack:
12+
description: "Stack(s)"
13+
type: choice
14+
options:
15+
- auto
16+
- heroku-20
17+
- heroku-22
18+
- heroku-24
19+
default: auto
20+
required: false
1121
dry_run:
12-
description: "Skip deploying to S3 (e.g. for testing)"
22+
description: "Skip uploading to S3 (dry run)"
1323
type: boolean
1424
default: false
1525
required: false
@@ -24,36 +34,73 @@ env:
2434
S3_BUCKET: "heroku-buildpack-python"
2535

2636
# Unfortunately these jobs cannot be easily written as a matrix since `matrix.exclude` does not
27-
# support expression syntax, and the `inputs` context is not available inside the job `if` key.
37+
# support expression syntax, and the `matrix` context is not available inside the job `if` key.
2838
jobs:
29-
build-and-upload-heroku-20:
30-
runs-on: pub-hk-ubuntu-22.04-xlarge
39+
heroku-20:
40+
if: inputs.stack == 'heroku-20' || inputs.stack == 'auto'
41+
runs-on: pub-hk-ubuntu-24.04-xlarge
3142
env:
3243
STACK_VERSION: "20"
3344
steps:
3445
- name: Checkout
3546
uses: actions/checkout@v4
3647
- name: Build Docker image
37-
run: docker build --pull --tag buildenv --build-arg=STACK_VERSION builds/
38-
- name: Build and package Python runtime
39-
run: docker run --rm --platform="linux/amd64" --volume="${PWD}/upload:/tmp/upload" buildenv ./build_python_runtime.sh "${{ inputs.python_version }}"
48+
run: docker build --platform="linux/amd64" --pull --tag buildenv --build-arg=STACK_VERSION builds/
49+
- name: Compile and package Python runtime
50+
run: docker run --rm --volume="${PWD}/upload:/tmp/upload" buildenv ./build_python_runtime.sh "${{ inputs.python_version }}"
51+
- name: Test Python runtime
52+
run: |
53+
RUN_IMAGE='heroku/heroku:${{ env.STACK_VERSION }}'
54+
ARCHIVE_FILENAME='python-${{ inputs.python_version }}-ubuntu-${{ env.STACK_VERSION }}.04-amd64.tar.zst'
55+
docker run --rm --volume="${PWD}/upload:/upload:ro" --volume="${PWD}/builds:/builds:ro" "${RUN_IMAGE}" /builds/test_python_runtime.sh "/upload/${ARCHIVE_FILENAME}"
4056
- name: Upload Python runtime archive to S3
4157
if: (!inputs.dry_run)
4258
run: aws s3 sync ./upload "s3://${S3_BUCKET}"
4359

44-
build-and-upload-heroku-22:
45-
# We only support Python 3.9+ on Heroku-22.
46-
if: (!startsWith(inputs.python_version,'3.8.'))
47-
runs-on: pub-hk-ubuntu-22.04-xlarge
60+
heroku-22:
61+
# On Heroku-22 we only support Python 3.9+.
62+
if: inputs.stack == 'heroku-22' || (inputs.stack == 'auto' && !startsWith(inputs.python_version,'3.8.'))
63+
runs-on: pub-hk-ubuntu-24.04-xlarge
4864
env:
4965
STACK_VERSION: "22"
5066
steps:
5167
- name: Checkout
5268
uses: actions/checkout@v4
5369
- name: Build Docker image
54-
run: docker build --pull --tag buildenv --build-arg=STACK_VERSION builds/
55-
- name: Build and package Python runtime
56-
run: docker run --rm --platform="linux/amd64" --volume="${PWD}/upload:/tmp/upload" buildenv ./build_python_runtime.sh "${{ inputs.python_version }}"
70+
run: docker build --platform="linux/amd64" --pull --tag buildenv --build-arg=STACK_VERSION builds/
71+
- name: Compile and package Python runtime
72+
run: docker run --rm --volume="${PWD}/upload:/tmp/upload" buildenv ./build_python_runtime.sh "${{ inputs.python_version }}"
73+
- name: Test Python runtime
74+
run: |
75+
RUN_IMAGE='heroku/heroku:${{ env.STACK_VERSION }}'
76+
ARCHIVE_FILENAME='python-${{ inputs.python_version }}-ubuntu-${{ env.STACK_VERSION }}.04-amd64.tar.zst'
77+
docker run --rm --volume="${PWD}/upload:/upload:ro" --volume="${PWD}/builds:/builds:ro" "${RUN_IMAGE}" /builds/test_python_runtime.sh "/upload/${ARCHIVE_FILENAME}"
78+
- name: Upload Python runtime archive to S3
79+
if: (!inputs.dry_run)
80+
run: aws s3 sync ./upload "s3://${S3_BUCKET}"
81+
82+
heroku-24:
83+
# On Heroku-24 we only support Python 3.10+.
84+
if: inputs.stack == 'heroku-24' || (inputs.stack == 'auto' && !startsWith(inputs.python_version,'3.8.') && !startsWith(inputs.python_version,'3.9.'))
85+
strategy:
86+
fail-fast: false
87+
matrix:
88+
arch: ["amd64", "arm64"]
89+
runs-on: ${{ matrix.arch == 'arm64' && 'pub-hk-ubuntu-24.04-arm-xlarge' || 'pub-hk-ubuntu-24.04-xlarge' }}
90+
env:
91+
STACK_VERSION: "24"
92+
steps:
93+
- name: Checkout
94+
uses: actions/checkout@v4
95+
- name: Build Docker image
96+
run: docker build --platform="linux/${{ matrix.arch }}" --pull --tag buildenv --build-arg=STACK_VERSION builds/
97+
- name: Compile and package Python runtime
98+
run: docker run --rm --volume="${PWD}/upload:/tmp/upload" buildenv ./build_python_runtime.sh "${{ inputs.python_version }}"
99+
- name: Test Python runtime
100+
run: |
101+
RUN_IMAGE='heroku/heroku:${{ env.STACK_VERSION }}'
102+
ARCHIVE_FILENAME='python-${{ inputs.python_version }}-ubuntu-${{ env.STACK_VERSION }}.04-${{ matrix.arch }}.tar.zst'
103+
docker run --rm --volume="${PWD}/upload:/upload:ro" --volume="${PWD}/builds:/builds:ro" "${RUN_IMAGE}" /builds/test_python_runtime.sh "/upload/${ARCHIVE_FILENAME}"
57104
- name: Upload Python runtime archive to S3
58105
if: (!inputs.dry_run)
59106
run: aws s3 sync ./upload "s3://${S3_BUCKET}"

.github/workflows/check_changelog.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ permissions:
99

1010
jobs:
1111
check-changelog:
12-
runs-on: ubuntu-latest
12+
runs-on: ubuntu-24.04
1313
if: (!contains(github.event.pull_request.labels.*.name, 'skip changelog'))
1414
steps:
1515
- name: Checkout

.github/workflows/ci.yml

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,44 +12,62 @@ permissions:
1212

1313
jobs:
1414
lint:
15-
runs-on: ubuntu-latest
15+
runs-on: ubuntu-24.04
1616
steps:
1717
- name: Checkout
1818
uses: actions/checkout@v4
1919
- name: Install Ruby and dependencies
2020
uses: ruby/setup-ruby@v1
2121
with:
2222
bundler-cache: true
23-
ruby-version: "3.1"
23+
ruby-version: "3.3"
2424
- name: Run ShellCheck
2525
run: make lint-scripts
2626
- name: Run Rubocop
2727
run: bundle exec rubocop
2828

2929
integration-test:
30-
runs-on: ubuntu-latest
30+
runs-on: ubuntu-24.04
3131
strategy:
3232
fail-fast: false
3333
matrix:
34-
stack: ["heroku-20", "heroku-22"]
34+
stack: ["heroku-20", "heroku-22", "heroku-24"]
3535
env:
3636
HATCHET_APP_LIMIT: 200
3737
HATCHET_DEFAULT_STACK: ${{ matrix.stack }}
38-
HATCHET_RETRIES: 2
38+
HATCHET_EXPENSIVE_MODE: 1
3939
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
4040
HEROKU_API_USER: ${{ secrets.HEROKU_API_USER }}
4141
HEROKU_DISABLE_AUTOUPDATE: 1
4242
PARALLEL_SPLIT_TEST_PROCESSES: 60
43+
RSPEC_RETRY_RETRY_COUNT: 3
4344
steps:
4445
- name: Checkout
4546
uses: actions/checkout@v4
4647
- name: Install Ruby and dependencies
4748
uses: ruby/setup-ruby@v1
4849
with:
4950
bundler-cache: true
50-
ruby-version: "3.1"
51+
ruby-version: "3.3"
5152
- name: Hatchet setup
5253
run: bundle exec hatchet ci:setup
5354
- name: Run Hatchet integration tests
5455
# parallel_split_test runs rspec in parallel, with concurrency equal to PARALLEL_SPLIT_TEST_PROCESSES.
5556
run: bundle exec parallel_split_test spec/hatchet/
57+
58+
container-test:
59+
runs-on: ubuntu-24.04
60+
defaults:
61+
run:
62+
# Work around lack of TTY causing errors when using `docker run -it`:
63+
# https://github.com/actions/runner/issues/241
64+
shell: 'script -q -e -c "bash -eo pipefail {0}"'
65+
steps:
66+
- name: Checkout
67+
uses: actions/checkout@v4
68+
# These test both the local development `make run` workflow and that `bin/report` completes successfully
69+
# for both passing and failing builds (since `bin/report` can't easily be tested via Hatchet tests).
70+
- name: Run buildpack using default app fixture
71+
run: make run
72+
- name: Run buildpack using an app fixture that's expected to fail
73+
run: make run FIXTURE=spec/fixtures/python_version_invalid/

.github/workflows/hatchet_app_cleaner.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ permissions:
1212

1313
jobs:
1414
hatchet-app-cleaner:
15-
runs-on: ubuntu-latest
15+
runs-on: ubuntu-24.04
1616
env:
1717
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
1818
HEROKU_API_USER: ${{ secrets.HEROKU_API_USER }}
@@ -24,7 +24,7 @@ jobs:
2424
uses: ruby/setup-ruby@v1
2525
with:
2626
bundler-cache: true
27-
ruby-version: "3.1"
27+
ruby-version: "3.3"
2828
- name: Run Hatchet destroy
2929
# Only apps older than 10 minutes are destroyed, to ensure that any
3030
# in progress CI runs are not interrupted.

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
__pycache__/
22
.hatchet/repos/
3+
.venv/
4+
.idea/
5+
# The setup-ruby GitHub Action creates this directory when caching is enabled, so we ignore
6+
# it here so it does not show up in the output of `git ls-files` for `make lint-scripts`.
7+
vendor/bundle/
38
.DS_Store
49
.rspec_status
510
.local_temp

.rubocop.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,9 @@ RSpec/Focus:
2626

2727
RSpec/MultipleExpectations:
2828
Enabled: false
29+
30+
Style/TrailingCommaInArrayLiteral:
31+
EnforcedStyleForMultiline: consistent_comma
32+
33+
Style/TrailingCommaInHashLiteral:
34+
EnforcedStyleForMultiline: consistent_comma

.shellcheckrc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Enable all checks, including the optional ones that are off by default.
2+
enable=all
3+
4+
# TODO: Triage and potentially enable more of these optional checks.
5+
6+
# SC2154 (warning): var is referenced but not assigned.
7+
disable=SC2154
8+
# SC2250 (style): Prefer putting braces around variable references even when not strictly required.
9+
disable=SC2250
10+
# SC2310 (info): This function is invoked in an 'if' condition so set -e will be disabled.
11+
disable=SC2310
12+
# SC2311 (info): Bash implicitly disabled set -e for this function invocation because it's inside a command substitution.
13+
disable=SC2311
14+
# SC2312 (info): Consider invoking this command separately to avoid masking its return value
15+
disable=SC2312

CHANGELOG.md

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,73 @@
33
## [Unreleased]
44

55

6+
## [v255] - 2024-08-07
7+
8+
- Added support for Python 3.12.5. ([#1622](https://github.com/heroku/heroku-buildpack-python/pull/1622))
9+
- Changed the default Python version for new apps from 3.12.4 to 3.12.5. ([#1622](https://github.com/heroku/heroku-buildpack-python/pull/1622))
10+
11+
## [v254] - 2024-07-16
12+
13+
- Updated setuptools from 69.2.0 to 70.3.0. ([#1614](https://github.com/heroku/heroku-buildpack-python/pull/1614))
14+
- Updated pipenv from 2023.12.1 to 2024.0.1. ([#1601](https://github.com/heroku/heroku-buildpack-python/pull/1601))
15+
16+
## [v253] - 2024-07-01
17+
18+
- Improved the error messages shown when an app is missing the necessary Python package manager files. ([#1608](https://github.com/heroku/heroku-buildpack-python/pull/1608))
19+
20+
## [v252] - 2024-06-17
21+
22+
- Removed export of `Pipfile.lock` to `requirements.txt` during the build. ([#1593](https://github.com/heroku/heroku-buildpack-python/pull/1593))
23+
- Removed internal `pipenv-to-pip` script that was unintentionally exposed onto `PATH`. ([#1593](https://github.com/heroku/heroku-buildpack-python/pull/1593))
24+
- Stopped exposing the internal `BIN_DIR`, `BPLOG_PREFIX`, `EXPORT_PATH` and `PROFILE_PATH` environment variables to `bin/{pre,post}_compile` and other subprocesses. ([#1595](https://github.com/heroku/heroku-buildpack-python/pull/1595) and [#1597](https://github.com/heroku/heroku-buildpack-python/pull/1597))
25+
- Implemented the `bin/report` build report API and removed log based metrics. ([#1597](https://github.com/heroku/heroku-buildpack-python/pull/1597))
26+
27+
## [v251] - 2024-06-07
28+
29+
- Added support for Python 3.12.4. ([#1591](https://github.com/heroku/heroku-buildpack-python/pull/1591))
30+
- Changed the default Python version for new apps from 3.12.3 to 3.12.4. ([#1591](https://github.com/heroku/heroku-buildpack-python/pull/1591))
31+
32+
## [v250] - 2024-04-26
33+
34+
- Added support for Heroku-24. ([#1575](https://github.com/heroku/heroku-buildpack-python/pull/1575))
35+
36+
## [v249] - 2024-04-18
37+
38+
- Improved the error message shown for EOL Python versions when using a stack for which those versions were never built. ([#1570](https://github.com/heroku/heroku-buildpack-python/pull/1570))
39+
- Fixed the "Python security update is available" warning being shown when the requested version is newer than the latest version known to the buildpack. ([#1569](https://github.com/heroku/heroku-buildpack-python/pull/1569))
40+
- Fixed glibc warnings seen when downgrading the stack version. ([#1568](https://github.com/heroku/heroku-buildpack-python/pull/1568))
41+
- Changed compression format and S3 URL for Python runtime archives. ([#1567](https://github.com/heroku/heroku-buildpack-python/pull/1567))
42+
- Adjusted compiler options used to build Python for improved parity with the Docker Hub Python images. ([#1566](https://github.com/heroku/heroku-buildpack-python/pull/1566))
43+
- Excluded `LD_LIBRARY_PATH` and `PYTHONHOME` app config vars when invoking subprocesses during the build. ([#1565](https://github.com/heroku/heroku-buildpack-python/pull/1565))
44+
45+
## [v248] - 2024-04-09
46+
47+
- Added support for Python 3.12.3. ([#1560](https://github.com/heroku/heroku-buildpack-python/pull/1560))
48+
- Changed the default Python version for new apps from 3.12.2 to 3.12.3. ([#1560](https://github.com/heroku/heroku-buildpack-python/pull/1560))
49+
50+
## [v247] - 2024-04-08
51+
52+
- Added support for Python 3.11.9. ([#1558](https://github.com/heroku/heroku-buildpack-python/pull/1558))
53+
54+
## [v246] - 2024-03-25
55+
56+
- Updated pip from 23.3.2 to 24.0. ([#1541](https://github.com/heroku/heroku-buildpack-python/pull/1541))
57+
- Updated setuptools from 68.2.2 to 69.2.0. ([#1553](https://github.com/heroku/heroku-buildpack-python/pull/1553))
58+
- Updated wheel from 0.42.0 to 0.43.0. ([#1550](https://github.com/heroku/heroku-buildpack-python/pull/1550))
59+
- Updated pipenv from 2023.11.15 to 2023.12.1. ([#1540](https://github.com/heroku/heroku-buildpack-python/pull/1540))
60+
61+
## [v245] - 2024-03-21
62+
63+
- Added support for Python 3.8.19, 3.9.19 and 3.10.14. ([#1551](https://github.com/heroku/heroku-buildpack-python/pull/1551))
64+
65+
## [v244] - 2024-03-13
66+
67+
- Improved the automatic `WEB_CONCURRENCY` feature: ([#1547](https://github.com/heroku/heroku-buildpack-python/pull/1547))
68+
- Switched to a dynamic calculation based on dyno CPU cores and memory instead of a hardcoded mapping.
69+
- Decreased default concurrency on `performance-m` / `private-m` / `shield-m` dynos from `8` to `5`.
70+
- Increased default concurrency on `performance-l` / `private-l` / `shield-l` dynos from `11` to `17`.
71+
- Added logging of memory/CPU/concurrency information to the app logs (for web dynos only).
72+
673
## [v243] - 2024-02-07
774

875
- Added support for Python 3.11.8 and 3.12.2. ([#1538](https://github.com/heroku/heroku-buildpack-python/pull/1538)).
@@ -958,7 +1025,19 @@ Default Python is now latest 2.7.10. Updated Pip and Distribute.
9581025
- Setuptools updated to v16.0
9591026
- Pip updated to v7.0.1
9601027

961-
[unreleased]: https://github.com/heroku/heroku-buildpack-python/compare/v243...main
1028+
[unreleased]: https://github.com/heroku/heroku-buildpack-python/compare/v255...main
1029+
[v255]: https://github.com/heroku/heroku-buildpack-python/compare/v254...v255
1030+
[v254]: https://github.com/heroku/heroku-buildpack-python/compare/v253...v254
1031+
[v253]: https://github.com/heroku/heroku-buildpack-python/compare/v252...v253
1032+
[v252]: https://github.com/heroku/heroku-buildpack-python/compare/v251...v252
1033+
[v251]: https://github.com/heroku/heroku-buildpack-python/compare/v250...v251
1034+
[v250]: https://github.com/heroku/heroku-buildpack-python/compare/v249...v250
1035+
[v249]: https://github.com/heroku/heroku-buildpack-python/compare/v248...v249
1036+
[v248]: https://github.com/heroku/heroku-buildpack-python/compare/v247...v248
1037+
[v247]: https://github.com/heroku/heroku-buildpack-python/compare/v246...v247
1038+
[v246]: https://github.com/heroku/heroku-buildpack-python/compare/v245...v246
1039+
[v245]: https://github.com/heroku/heroku-buildpack-python/compare/v244...v245
1040+
[v244]: https://github.com/heroku/heroku-buildpack-python/compare/v243...v244
9621041
[v243]: https://github.com/heroku/heroku-buildpack-python/compare/v242...v243
9631042
[v242]: https://github.com/heroku/heroku-buildpack-python/compare/v241...v242
9641043
[v241]: https://github.com/heroku/heroku-buildpack-python/compare/v240...v241

Gemfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22

33
source 'https://rubygems.org'
44

5-
ruby '>= 3.1', '< 3.3'
5+
ruby '>= 3.1', '< 3.4'
66

77
group :test, :development do
88
gem 'heroku_hatchet'
99
gem 'parallel_split_test'
1010
gem 'rspec-core'
1111
gem 'rspec-expectations'
12+
gem 'rspec-retry'
1213
gem 'rubocop', require: false
1314
gem 'rubocop-rspec', require: false
1415
end

0 commit comments

Comments
 (0)