Compare commits

...

3 Commits

Author SHA1 Message Date
Joe Kutner 60614232da Set Codeowners to languages (#953)
* Set languages as codeowners

* Update changelog
2020-04-21 17:39:56 -05:00
Joe Kutner edb7004a28 Update hatchet tests to support latest version of Python (#952)
* Update hatchet tests to support latest version of Python

* Empty commit to trigger CI
2020-04-21 16:42:56 -05:00
Casey ea350a6694 Bugfix: Caching on subsequent redeploys (#948)
* Don't clear the cache on first app deploy

* Add output for debugging cache behavior

* Debug output of changes, clean up whitespace

* Update hatchet to use latest getting started guide

* Clean up caching output logs

This output was confusing and unhelptul to most users

* Changelog

* Test if we need these lines

* dang fi

* Remove unnecessary code

* Remove confusing output of change

* Update log output

* Update test to match new expected log output

* Update changelog
2020-04-21 15:41:57 -05:00
8 changed files with 32 additions and 22 deletions
-1
View File
@@ -1,2 +1 @@
* @heroku/languages
* @heroku/buildpack-maintainers
+4
View File
@@ -2,6 +2,10 @@
# Master
- Set Code Owners to @heroku/langauges
- Bugfix: Caching on subsequent redeploys
- Update tests to support latest version of Python
--------------------------------------------------------------------------------
# 168 (2020-04-06)
+1 -1
View File
@@ -175,7 +175,7 @@ cd "$BUILD_DIR"
# - Once the build is complete, `~/.heroku/{known-paths}` is copied back into the cache.
# Create the cache directory, if it doesn't exist.
mkdir -p "$CACHE_DIR"
mkdir -p "$CACHE_DIR/.heroku"
# Restore old artifacts from the cache.
mkdir -p .heroku
+4 -9
View File
@@ -100,22 +100,17 @@ if [[ ! -f "$CACHE_DIR/.heroku/requirements.txt" ]]; then
# IF there's no cached dependencies, update cached version of requirements.txt
# This should only run for new apps and first deploys after this update
cp -R "$BUILD_DIR/requirements.txt" "$CACHE_DIR/.heroku/requirements.txt"
# If we don't already have a python version, this is a new app
if [ -f .heroku/python-version ]; then
puts-step "Clearing cached dependencies"
# if there are any differences, clear the Python cache
# Installing Python over again does not take noticably more time
rm -rf .heroku/python
unset SKIP_INSTALL
fi
else
# IF there IS a cached directory, check for differences with the new one
if ! diff "$BUILD_DIR/requirements.txt" "$CACHE_DIR/.heroku/requirements.txt" &> /dev/null; then
puts-step "Clearing cached dependencies"
puts-step "Requirements file has been changed, clearing cached dependencies"
# if there are any differences, clear the Python cache
# Installing Python over again does not take noticably more time
cp -R "$BUILD_DIR/requirements.txt" "$CACHE_DIR/.heroku/requirements.txt"
rm -rf .heroku/python
unset SKIP_INSTALL
else
puts-step "No change in requirements detected, installing from cache"
fi
fi
-1
View File
@@ -67,7 +67,6 @@ buildpack_sqlite3_install() {
puts-step "Installing SQLite3"
if sqlite3_install "$BUILD_DIR/.heroku/python" ; then
echo "Sqlite3 successfully installed."
mcount "success.python.sqlite3"
else
echo "Sqlite3 failed to install."
+1 -1
View File
@@ -1,3 +1,3 @@
---
- - "./repos/python/python-getting-started"
- f56b90499ec11e1c9576da2f8c7331300e189db3
- 443a90c58be6881583cd7ef628e3869e3c30bb98
+22 -8
View File
@@ -3,26 +3,40 @@ require_relative '../spec_helper'
describe "Default Python Deploy" do
it "🐍" do
Hatchet::Runner.new('python-getting-started', stack: DEFAULT_STACK).deploy do |app|
# What should happen on first deploy
expect(app.output).to match(/Installing pip/)
expect(app.run('python -V')).to match(/3.6.10/)
# What should not happen
expect(app.output).to_not match("Requirements file has been changed, updating cache")
expect(app.output).to_not match("No change in requirements detected, installing from cache")
expect(app.output).to_not match("No such file or directory")
expect(app.output).to_not match("cp: cannot create regular file")
expect(app.output).to_not match("Clearing cached dependencies")
# Redeploy
# Redeploy with changed requirements file
run!(%Q{echo "" >> requirements.txt})
run!(%Q{echo "flask" >> requirements.txt})
run!(%Q{git add . ; git commit --allow-empty -m next})
app.push!
# Check for the cache tohave cleared
expect(app.output).to match("Clearing cached dependencies")
# Check for the cache to have cleared
expect(app.output).to match("Requirements file has been changed, updating cache")
# What should not happen when the requirements file is changed
expect(app.output).to_not match("No dependencies found, preparing to install")
expect(app.output).to_not match("No change in requirements detected, installing from cache")
run!(%Q{git commit --allow-empty -m next})
app.push!
# The cache should not clear with no changes
expect(app.output).to_not match("Clearing cached dependencies")
# With no changes on redeploy, the cache should
expect(app.output).to match("No change in requirements detected, installing from cache")
# With no changes on redeploy, the cache should not
expect(app.output).to_not match("Requirements file has been changed, updating cache")
expect(app.output).to_not match("No dependencies found, preparing to install")
expect(app.run('python -V')).to match(/3.7.6/)
end
end
end
-1
View File
@@ -56,7 +56,6 @@ testPysqlite() {
testSqliteInstall() {
compile "pythonDefault"
assertCaptured "Sqlite3 successfully installed."
assertNotCaptured "Sqlite3 failed to install."
assertCapturedSuccess
}