From 385296c270817eeaaf706b9b27963146f37aa551 Mon Sep 17 00:00:00 2001 From: Casey Faist Date: Thu, 29 Aug 2019 15:31:26 -0700 Subject: [PATCH] Add support for testing binaries in staging/ on S3 This will allow for faster and more transparent deploys for Python and other built dependencies. --- .gitignore | 3 ++- Makefile | 8 ++++++++ bin/compile | 7 +++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index ea39393..1ffa3cb 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ repos/* #Venv buildpack/* -builds/dockerenv +builds/dockerenv.staging* +builds/dockerenv.production diff --git a/Makefile b/Makefile index ab2be13..6a09cb0 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,14 @@ check: @shellcheck -x bin/steps/collectstatic bin/steps/eggpath-fix bin/steps/eggpath-fix2 bin/steps/gdal bin/steps/geo-libs bin/steps/mercurial bin/steps/nltk bin/steps/pip-install bin/steps/pip-uninstall bin/steps/pipenv bin/steps/pipenv-python-version bin/steps/pylibmc bin/steps/python @shellcheck -x bin/steps/hooks/* +test-staging: + @echo "Running tests against staged binaries..." + @docker run -v $(shell pwd):/buildpack:ro --rm -it -e "STACK=heroku-16" -e "TEST_STAGED_S3_BINARIES=1" heroku/heroku:16-build bash -c 'cp -r /buildpack /buildpack_test; cd /buildpack_test/; test/run;' + @echo "" + @echo "Running tests in docker (heroku-18)..." + @docker run -v $(shell pwd):/buildpack:ro --rm -it -e "STACK=heroku-18" -e "TEST_STAGED_S3_BINARIES=1" heroku/heroku:18-build bash -c 'cp -r /buildpack /buildpack_test; cd /buildpack_test/; test/run;' + @echo "" + test-heroku-16: @echo "Running tests in docker (heroku-16)..." @docker run -v $(shell pwd):/buildpack:ro --rm -it -e "STACK=heroku-16" heroku/heroku:16-build bash -c 'cp -r /buildpack /buildpack_test; cd /buildpack_test/; test/run;' diff --git a/bin/compile b/bin/compile index dfc81d1..1d70e67 100755 --- a/bin/compile +++ b/bin/compile @@ -43,6 +43,13 @@ VENDOR_URL="https://lang-python.s3.amazonaws.com/$STACK" if [[ -n ${BUILDPACK_VENDOR_URL:-} ]]; then VENDOR_URL="$BUILDPACK_VENDOR_URL" fi + +# Build binaries (python runtimes, etc) in the /staging/ directory on S3. Test +these binaries for compatibility when passed this environment variable. +if [ "$TEST_STAGED_S3_BINARIES" == "1" ]; then + echo "Testing staged binaries..." + VENDOR_URL="https://lang-python.s3.amazonaws.com/staging/$STACK" +fi export VENDOR_URL # Default Python Versions