From b250300b746841b53f73ae9e3064cfa68cba9870 Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Tue, 6 Oct 2020 09:23:38 +0100 Subject: [PATCH] Migrate to a new S3 bucket (#1089) Since: * We want the S3 bucket to be owned by a different AWS account and it's not possible to transfer ownership of an existing bucket. * In the future we want to rebuild some of the Python runtime archives (for example to improve the sqlite3 handling, or to tweak the compile flags used), and it will be easier to reason about the change if we can guarantee only recent buildpack versions are using the assets rather than several year old unmaintained forks. The assets were synced from the old bucket using (minus the `--dryrun`): ``` aws s3 sync s3://lang-python s3://heroku-buildpack-python \ --dryrun \ --metadata-directive REPLACE \ --exclude "*" \ --include 'common/*' \ --include 'heroku-*/runtimes/*' \ --include 'heroku-*/libraries/vendor/gdal.tar.gz' \ --include 'heroku-*/libraries/vendor/geos.tar.gz' \ --include 'heroku-*/libraries/vendor/proj.tar.gz' \ --exclude 'common/pip-20.0.2-py2.py3-none-any.whl' \ --exclude '*/runtimes/*-opt.tar.gz' \ --exclude '*/runtimes/sqlite-free/*' ``` The files that were `--exclude`d are those that are no longer used, or test assets that were not officially released. The Cedar-14 assets were not migrated since it's EOL next month. The old S3 bucket will be left untouched for the foreseeable future (ie: we won't be deleting it), since builds using older versions of this buildpack (either due to pinning to a tag or via a fork) will still be using assets from it. Closes @W-8060097@. --- CHANGELOG.md | 1 + bin/compile | 7 ++++++- builds/heroku-16.Dockerfile | 2 +- builds/heroku-18.Dockerfile | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fda598e..1be561e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- Migrate from the `lang-python` S3 bucket to `heroku-buildpack-python` (#1089). - Remove `vendor/shunit2` (#1086). - Replace `BUILDPACK_VENDOR_URL` and `USE_STAGING_BINARIES` with `BUILDPACK_S3_BASE_URL` (#1085). diff --git a/bin/compile b/bin/compile index 11422f6..8c356d7 100755 --- a/bin/compile +++ b/bin/compile @@ -41,7 +41,12 @@ export BUILD_DIR CACHE_DIR ENV_DIR # The user can provide BUILDPACK_S3_BASE_URL to specify a custom target. # Note: this is designed for non-Heroku use, as it does not use the user-provided # environment variable mechanism (the ENV_DIR). -DEFAULT_S3_BASE_URL='https://lang-python.s3.amazonaws.com' +if [[ "${STACK}" == "cedar-14" ]]; then + # Since Cedar-14 is EOL on 2020-11-02 it's not worth migrating it to the new bucket. + DEFAULT_S3_BASE_URL='https://lang-python.s3.amazonaws.com' +else + DEFAULT_S3_BASE_URL='https://heroku-buildpack-python.s3.amazonaws.com' +fi S3_BASE_URL="${BUILDPACK_S3_BASE_URL:-${DEFAULT_S3_BASE_URL}}" # This has to be exported since it's used by the geo-libs step which is run in a subshell. # TODO: Stop exporting once the geo-libs step is removed or no longer uses `sub_env`. diff --git a/builds/heroku-16.Dockerfile b/builds/heroku-16.Dockerfile index c9b2bdf..cd19b57 100644 --- a/builds/heroku-16.Dockerfile +++ b/builds/heroku-16.Dockerfile @@ -1,7 +1,7 @@ FROM heroku/heroku:16-build ENV WORKSPACE_DIR="/app/builds" \ - S3_BUCKET="lang-python" \ + S3_BUCKET="heroku-buildpack-python" \ S3_PREFIX="heroku-16/" \ STACK="heroku-16" diff --git a/builds/heroku-18.Dockerfile b/builds/heroku-18.Dockerfile index edcc11d..ab992b0 100644 --- a/builds/heroku-18.Dockerfile +++ b/builds/heroku-18.Dockerfile @@ -1,7 +1,7 @@ FROM heroku/heroku:18-build ENV WORKSPACE_DIR="/app/builds" \ - S3_BUCKET="lang-python" \ + S3_BUCKET="heroku-buildpack-python" \ S3_PREFIX="heroku-18/" \ STACK="heroku-18"