Skip to content

Config merging; build environment variables #6

Merged
merged 2 commits into from Jul 7, 2012

3 participants

@bernerdschaefer

This commit includes two separate but related features:

  1. Instead of only taking the last release config, the YAML is parsed and merged after each step. It's quite dumb now, just a "deep merge" on the values emitted by each step, but could be upgraded to even, say, merge "PATH" settings, etc.

  2. It adds awareness for a custom key in bin/release's yaml: build_env. It's like config_vars, except that each stage in a multi-build is run with the combined build_env of each previous step.

I'd like some feedback on this, but here's my use case:

I needed libcairo (with development dependencies), which isn't available on heroku. So I put together a buildpack for it, but realized there was no way to pass information from my buildpack into the ruby build pack for installing the "cairo" gem.

So now my cairo buildpack now does this in bin/release:

#!/bin/sh
# bin/release <build-dir>

set -e

BUILD_DIR=$1

LIB_PATH="$BUILD_DIR/vendor/cairo/lib:$BUILD_DIR/vendor/pixman-0.26/lib"
INCLUDE_PATH="$BUILD_DIR/vendor/cairo/include/cairo:$BUILD_DIR/vendor/pixman-0.26/include/pixman-1"
PKG_CONFIG_PATH="$BUILD_DIR/vendor/cairo/lib/pkgconfig:$BUILD_DIR/vendor/pixman-0.26/lib/pkgconfig"

cat << EOF
---
build_env:
  BUNDLE_BUILD__CAIRO: "--with-opt-lib=${LIB_PATH} --with-opt-include=${INCLUDE_PATH} --with-pkg-config=${PKG_CONFIG_PATH}"
config_vars:
  PATH: "bin:/app/vendor/cairo/bin:/usr/local/bin:/usr/bin:/bin"
EOF

So that a user can do a multi-build pack with cairo + ruby, do 'gem "cairo"', and everything just works!

bernerdschaefer added some commits Jul 6, 2012
@bernerdschaefer bernerdschaefer Give bin/compile arguments meaningful names c89fa1d
@bernerdschaefer bernerdschaefer Merge release configurations for each framework
Also adds support for a 'build_env' key in the release yaml for updating
the config used on the build server.
f2e9d1d
@ddollar ddollar merged commit 35ae1fe into ddollar:master Jul 7, 2012
@ddollar
Owner
ddollar commented Jul 7, 2012

This is awesome, thanks!

@ddollar ddollar added a commit that referenced this pull request Jul 10, 2012
@ddollar Revert "Merge pull request #6 from bernerdschaefer/build-env-with-con…
…fig-merging"

This reverts commit 35ae1fe, reversing
changes made to 69f4e67.
2a4cefc
@timshadel

What triggered the revert? Just curious..

@ddollar
Owner
ddollar commented Jul 13, 2012

#7

@tomjack tomjack pushed a commit to loku/heroku-buildpack-multi that referenced this pull request Jul 16, 2012
Tom Jack Revert "Revert "Merge pull request #6 from bernerdschaefer/build-env-…
…with-config-merging""

This reverts commit 2a4cefc.
2c05008
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.