Bug Report: Build packs on Heroku are not fully applied if you specify the BUILDPACK_URL after creation

This is an issue I am having when trying to use a custom buildpack with Heroku. The intent of the buildpack is to update the version of ImageMagick on the heroku dyno which is over 2 years old.

Steps to Reproduce

# setup
git clone https://github.com/WilliamDenniss/heroku-im-test
cd heroku-im-test 

# setup App1 with the buildpack specificed on create
heroku create --stack cedar --buildpack https://github.com/WilliamDenniss/heroku-buildpack-ruby-imagemagick.git#imagemagick --app herokuimtest-buildpackstart --remote buildpackstart
git push buildpackstart master
# result: http://herokuimtest-buildpackstart.herokuapp.com/
# => ImageMagick 6.7.8-0 2012-06-30 Q16 http://www.imagemagick.org

# setup App2 and configure the buildpack after creation
heroku create --stack cedar --app herokuimtest-buildpackafter --remote buildpackafter
git push buildpackafter master
# result: http://herokuimtest-buildpackafter.herokuapp.com/
# => ImageMagick 6.5.7-8 2010-12-02 Q16 http://www.imagemagick.org

# update buildpack on App2 with the same buildpack from App1 and push an update to force the redeploy
heroku config:set "BUILDPACK_URL=https://github.com/WilliamDenniss/heroku-buildpack-ruby-imagemagick.git#imagemagick
" --app herokuimtest-buildpackafter
echo "1" >> Version.txt
git add Version.txt
git commit -m "version bump"
git push buildpackafter master
# result: build pack was picked up, and applied on deploy "-----> Fetching custom git buildpack... Switched to a new branch 'imagemagick'"
# result: http://herokuimtest-buildpackafter.herokuapp.com/
# => ImageMagick 6.5.7-8 2010-12-02 Q16 http://www.imagemagick.org

Expected results

After updating the buildpack on the second app, both apps (the one created upfront with the buildpack, the one with the buildpack added later) should match.

Actual results

Despite setting the buildpack, the version of ImageMagick is still the old one from when the buildpack wasn’t applied.

Workaround

If you’re creating ImageMagick buildpacks for Heroku, you must spin up a new app every time you make changes to the buildpack to be certain they are applied.

Additional Information

Log output of deploy, and contents of the site:

App1’s output:

$ git push buildpackstart master
Counting objects: 93, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (79/79), done.
Writing objects: 100% (93/93), 28.44 KiB, done.
Total 93 (delta 22), reused 0 (delta 0)

-----> Fetching custom git buildpack... done
-----> Ruby/Rails app detected
       uninstalling rmagick
       uninstalling rmagick 2
-----> Installing ImageMagick 6.7.8-0
       https://s3.amazonaws.com/geospike-deploy/ImageMagick-6.7.8-0.tgz
       https://s3.amazonaws.com/geospike-deploy/libpng-1.5.11.tgz
-----> Installing dependencies using Bundler version 1.3.2
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
       with env_vars: env BUNDLE_GEMFILE=/tmp/build_39mavanuaja3h/Gemfile BUNDLE_CONFIG=/tmp/build_39mavanuaja3h/.bundle/config CPATH=/tmp/libyaml-20130418-522-1b24ja/libyaml-0.1.4/include:$CPATH CPPATH=/tmp/libyaml-20130418-522-1b24ja/libyaml-0.1.4/include:$CPPATH LIBRARY_PATH=/tmp/libyaml-20130418-522-1b24ja/libyaml-0.1.4/lib:$LIBRARY_PATH RUBYOPT="-r/tmp/buildpack_39mavanuaja3h/vendor/syck_hack" CFLAGS="-fopenmp -I/tmp/build_39mavanuaja3h/vendor/ImageMagick-6.7.8-0/include/ImageMagick" CPPFLAGS="-fopenmp -I/tmp/build_39mavanuaja3h/vendor/ImageMagick-6.7.8-0/include/ImageMagick" LDFLAGS="-L/tmp/build_39mavanuaja3h/vendor/ImageMagick-6.7.8-0/lib -Wl,-R/tmp/build_39mavanuaja3h/vendor/ImageMagick-6.7.8-0/lib -L/app/vendor/ImageMagick-6.7.8-0/lib -Wl,-R/app/vendor/ImageMagick-6.7.8-0/lib" LIBS="-L/tmp/build_39mavanuaja3h/vendor/ImageMagick-6.7.8-0/lib -L/app/vendor/ImageMagick-6.7.8-0/lib"
       Fetching gem metadata from https://rubygems.org/.........
       Fetching gem metadata from https://rubygems.org/..
       Installing rake (10.0.3)
       Installing i18n (0.6.4)
       Installing multi_json (1.7.1)
       Installing activesupport (3.2.12)
       Installing builder (3.0.4)
       Installing activemodel (3.2.12)
       Installing erubis (2.7.0)
       Installing journey (1.0.4)
       Installing rack (1.4.5)
       Installing rack-cache (1.2)
       Installing rack-test (0.6.2)
       Installing hike (1.2.1)
       Installing tilt (1.3.6)
       Installing sprockets (2.2.2)
       Installing actionpack (3.2.12)
       Installing mime-types (1.21)
       Installing polyglot (0.3.3)
       Installing treetop (1.4.12)
       Installing mail (2.4.4)
       Installing actionmailer (3.2.12)
       Installing arel (3.0.2)
       Installing tzinfo (0.3.37)
       Installing activerecord (3.2.12)
       Installing activeresource (3.2.12)
       Installing coffee-script-source (1.6.1)
       Installing execjs (1.4.0)
       Installing coffee-script (2.2.0)
       Installing rack-ssl (1.3.3)
       Installing json (1.7.7)
       Installing rdoc (3.12.2)
       Installing thor (0.17.0)
       Installing railties (3.2.12)
       Installing coffee-rails (3.2.2)
       Installing jquery-rails (2.2.1)
       Using bundler (1.3.2)
       Installing rails (3.2.12)
       Installing rmagick (2.13.1)
       Installing sass (3.2.7)
       Installing sass-rails (3.2.6)
       Installing uglifier (1.3.0)
       Your bundle is complete! It was installed into ./vendor/bundle
       Post-install message from rdoc:
       Depending on your version of ruby, you may need to install ruby rdoc/ri data:
       <= 1.8.6 : unsupported
       = 1.8.7 : gem install rdoc-data; rdoc-data --install
       = 1.9.1 : gem install rdoc-data; rdoc-data --install
       >= 1.9.2 : nothing to do! Yay!
       Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       Asset precompilation completed (11.21s)
-----> Rails plugin injection
       Injecting rails_log_stdout
       Injecting rails3_serve_static_assets
-----> Discovering process types
       Procfile declares types      -> (none)
       Default types for Ruby/Rails -> console, rake, web, worker

-----> Compiled slug size: 21.4MB
-----> Launching... done, v7
       http://herokuimtest-buildpackstart.herokuapp.com deployed to Heroku

http://herokuimtest-buildpackstart.herokuapp.com/

ImageMagick 6.7.8-0 2012-06-30 Q16 http://www.imagemagick.org

App2’s output when initially pushed.

$ git push buildpackafter master


heroku config:set "BUILDPACK_URL=https://github.com/WilliamDenniss/heroku-buildpack-ruby-imagemagick.git#imagemagick
" --app herokuimtest-buildpackafter
Counting objects: 93, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (79/79), done.
Writing objects: 100% (93/93), 28.44 KiB, done.
Total 93 (delta 22), reused 0 (delta 0)

-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.3.2
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
       Fetching gem metadata from https://rubygems.org/.........
       Fetching gem metadata from https://rubygems.org/..
       Installing rake (10.0.3)
       Installing i18n (0.6.4)
       Installing multi_json (1.7.1)
       Installing activesupport (3.2.12)
       Installing builder (3.0.4)
       Installing activemodel (3.2.12)
       Installing erubis (2.7.0)
       Installing journey (1.0.4)
       Installing rack (1.4.5)
       Installing rack-cache (1.2)
       Installing rack-test (0.6.2)
       Installing hike (1.2.1)
       Installing tilt (1.3.6)
       Installing sprockets (2.2.2)
       Installing actionpack (3.2.12)
       Installing mime-types (1.21)
       Installing polyglot (0.3.3)
       Installing treetop (1.4.12)
       Installing mail (2.4.4)
       Installing actionmailer (3.2.12)
       Installing arel (3.0.2)
       Installing tzinfo (0.3.37)
       Installing activerecord (3.2.12)
       Installing activeresource (3.2.12)
       Installing coffee-script-source (1.6.1)
       Installing execjs (1.4.0)
       Installing coffee-script (2.2.0)
       Installing rack-ssl (1.3.3)
       Installing json (1.7.7)
       Installing rdoc (3.12.2)
       Installing thor (0.17.0)
       Installing railties (3.2.12)
       Installing coffee-rails (3.2.2)
       Installing jquery-rails (2.2.1)
       Using bundler (1.3.2)
       Installing rails (3.2.12)
       Installing rmagick (2.13.1)
       Installing sass (3.2.7)
       Installing sass-rails (3.2.6)
       Installing uglifier (1.3.0)
       Your bundle is complete! It was installed into ./vendor/bundle
       Post-install message from rdoc:
       Depending on your version of ruby, you may need to install ruby rdoc/ri data:
       <= 1.8.6 : unsupported
       = 1.8.7 : gem install rdoc-data; rdoc-data --install
       = 1.9.1 : gem install rdoc-data; rdoc-data --install
       >= 1.9.2 : nothing to do! Yay!
       Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       Asset precompilation completed (12.72s)
-----> Rails plugin injection
       Injecting rails_log_stdout
       Injecting rails3_serve_static_assets
-----> Discovering process types
       Procfile declares types      -> (none)
       Default types for Ruby/Rails -> console, rake, web, worker

-----> Compiled slug size: 10.6MB
-----> Launching... done, v6
       http://herokuimtest-buildpackafter.herokuapp.com deployed to Heroku

http://herokuimtest-buildpackafter.herokuapp.com/

ImageMagick 6.5.7-8 2010-12-02 Q16 http://www.imagemagick.org

App2’s output after the build-pack is added and code is pushed:

$ git push buildpackafter master

Counting objects: 4, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 283 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)

-----> Fetching custom git buildpack... Switched to a new branch 'imagemagick'
done
-----> Ruby/Rails app detected
       uninstalling rmagick
       uninstalling rmagick 2
-----> Installing ImageMagick 6.7.8-0
       https://s3.amazonaws.com/geospike-deploy/ImageMagick-6.7.8-0.tgz
       https://s3.amazonaws.com/geospike-deploy/libpng-1.5.11.tgz
-----> Installing dependencies using Bundler version 1.3.2
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
       with env_vars: env BUNDLE_GEMFILE=/tmp/build_pf1ivez0iv2k/Gemfile BUNDLE_CONFIG=/tmp/build_pf1ivez0iv2k/.bundle/config CPATH=/tmp/libyaml-20130418-520-21wiw/libyaml-0.1.4/include:$CPATH CPPATH=/tmp/libyaml-20130418-520-21wiw/libyaml-0.1.4/include:$CPPATH LIBRARY_PATH=/tmp/libyaml-20130418-520-21wiw/libyaml-0.1.4/lib:$LIBRARY_PATH RUBYOPT="-r/tmp/buildpack_pf1ivez0iv2k/vendor/syck_hack" CFLAGS="-fopenmp -I/tmp/build_pf1ivez0iv2k/vendor/ImageMagick-6.7.8-0/include/ImageMagick" CPPFLAGS="-fopenmp -I/tmp/build_pf1ivez0iv2k/vendor/ImageMagick-6.7.8-0/include/ImageMagick" LDFLAGS="-L/tmp/build_pf1ivez0iv2k/vendor/ImageMagick-6.7.8-0/lib -Wl,-R/tmp/build_pf1ivez0iv2k/vendor/ImageMagick-6.7.8-0/lib -L/app/vendor/ImageMagick-6.7.8-0/lib -Wl,-R/app/vendor/ImageMagick-6.7.8-0/lib" LIBS="-L/tmp/build_pf1ivez0iv2k/vendor/ImageMagick-6.7.8-0/lib -L/app/vendor/ImageMagick-6.7.8-0/lib"
       Using rake (10.0.3)
       Using i18n (0.6.4)
       Using multi_json (1.7.1)
       Using activesupport (3.2.12)
       Using builder (3.0.4)
       Using activemodel (3.2.12)
       Using erubis (2.7.0)
       Using journey (1.0.4)
       Using rack (1.4.5)
       Using rack-cache (1.2)
       Using rack-test (0.6.2)
       Using hike (1.2.1)
       Using tilt (1.3.6)
       Using sprockets (2.2.2)
       Using actionpack (3.2.12)
       Using mime-types (1.21)
       Using polyglot (0.3.3)
       Using treetop (1.4.12)
       Using mail (2.4.4)
       Using actionmailer (3.2.12)
       Using arel (3.0.2)
       Using tzinfo (0.3.37)
       Using activerecord (3.2.12)
       Using activeresource (3.2.12)
       Using coffee-script-source (1.6.1)
       Using execjs (1.4.0)
       Using coffee-script (2.2.0)
       Using rack-ssl (1.3.3)
       Using json (1.7.7)
       Using rdoc (3.12.2)
       Using thor (0.17.0)
       Using railties (3.2.12)
       Using coffee-rails (3.2.2)
       Using jquery-rails (2.2.1)
       Using bundler (1.3.2)
       Using rails (3.2.12)
       Using rmagick (2.13.1)
       Using sass (3.2.7)
       Using sass-rails (3.2.6)
       Using uglifier (1.3.0)
       Your bundle is complete! It was installed into ./vendor/bundle
       Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       Asset precompilation completed (10.57s)
-----> Rails plugin injection
       Injecting rails_log_stdout
       Injecting rails3_serve_static_assets
-----> Discovering process types
       Procfile declares types      -> (none)
       Default types for Ruby/Rails -> console, rake, web, worker

-----> Compiled slug size: 21.4MB
-----> Launching... done, v8
       http://herokuimtest-buildpackafter.herokuapp.com deployed to Heroku

http://herokuimtest-buildpackafter.herokuapp.com/

ImageMagick 6.5.7-8 2010-12-02 Q16 http://www.imagemagick.org

Leave a Reply

Your email address will not be published. Required fields are marked *