Skip to content

Commit 17ccf8a

Browse files
committed
feat(builder): Adding support to lock BUILDPACK_URL to a git revision
You can set an exact version of a buildpack by using a git revision in your BUILDPACK_URL. `git://repo.git#master` `git://repo.git#v1.2.0`
1 parent f6bcb25 commit 17ccf8a

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

builder/image/slugbuilder/builder/build.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,16 @@ if [[ -n "$BUILDPACK_URL" ]]; then
7979

8080
buildpack="$buildpack_root/custom"
8181
rm -fr "$buildpack"
82-
git clone --quiet --depth=1 "$BUILDPACK_URL" "$buildpack"
82+
83+
url=${BUILDPACK_URL%#*}
84+
branch=${BUILDPACK_URL#*#}
85+
86+
if [ "$branch" == "$url" ]; then
87+
branch="master"
88+
fi
89+
90+
git clone --quiet --branch "$branch" --depth=1 "$url" "$buildpack"
91+
8392
selected_buildpack="$buildpack"
8493
buildpack_name=$($buildpack/bin/detect "$build_root") && selected_buildpack=$buildpack
8594
else

docs/using_deis/using-buildpacks.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,14 @@ To use a custom buildpack, set the ``BUILDPACK_URL`` environment variable.
135135
=== humble-autoharp
136136
BUILDPACK_URL: https://github.com/dpiddy/heroku-buildpack-ruby-minimal
137137
138+
.. note::
139+
140+
If, however, you're unable to deploy using the latest version of the buildpack,
141+
You can set
142+
an exact version of a buildpack by using a git revision in your
143+
``BUILDPACK_URL``.
144+
For example: ``BUILDPACK_URL=https://github.com/dpiddy/heroku-buildpack-ruby-minimal#v13``
145+
138146
On your next ``git push``, the custom buildpack will be used.
139147

140148

0 commit comments

Comments
 (0)