Creating an Offline Buildpack

245 views
Skip to first unread message

marco...@sap.com

unread,
Aug 6, 2014, 3:44:00 AM8/6/14
to vcap...@cloudfoundry.org
Hey guys,

as an exercise we've recently created a very simple custom buildpack. After reading the official documentation [1] and having a look at how the ruby buildpack works [2], I tried to understand how to add support for creating an offline buildpack.

The existing resources [3,4], however, point to the java buildpack, which seems to take a different approach than the ruby buildpack: It does not implement /bin/package as proposed in the official documentation [1] and does not use the buildpack-packager [5] like the ruby buildpack, but rather offers a custom rake task. 

So, I'm a bit confused here: 
* Is there a recommended way how to create a custom offline buildpack? 
* If it is the way described in the official documentation (implement bin/package, use the buildpack-packager), then who is supposed to call bin/package? Is this also done by the framework just like the other scripts in bin, such as bin/[detect|compile|release]?
* If bin/package is not called by the framework somehow, is it the CF admin's task to create the offline .zip from a repository containing a buildpack and uploading it with create-buildpack?
* How do you test (offline and online) buildpacks? The ruby buildpack seems to use Machete [6] - is there some more documentation available? Are there other good alternatives?

And maybe a stupid question: Why does cf push -b allow to specify a URL to a git repo containing a buildpack, but cf create-buildpack does not?

Thanks for your help on this!

Warm regards
Marco Voelz

Guillaume Berche

unread,
Jan 27, 2015, 9:12:11 AM1/27/15
to vcap...@cloudfoundry.org
Marco, I ran into your thread while reading the /bin/package documented extension. It seems to me that this extension isn't adopted and should probably be removed from the official documentation. See related thread at [0].

It seems to me that it indeed is the cf-admin's role to:
-  fetch the buildpack source,
- fetch remote dependencies (potentially using the buildpack-manager or another mechanism specific to the buildpack such as java-buildpack-dependency-builder [1]),
- and then call the unnormalized way of producing a zip file (containing the buildpack source files and offline dependencies but excluding test files) and then use cf cli to upload it as a system buildpack.

I've submitted an issue onto, as this thread seems to went unnoticed. [2]

[0] https://groups.google.com/a/cloudfoundry.org/forum/#!msg/vcap-dev/UR7h5MroGE4/RmPqh46V5QIJ
[1] https://github.com/cloudfoundry/java-buildpack-dependency-builder
[2] https://github.com/cloudfoundry/docs-buildpacks/issues/16

jche...@pivotal.io

unread,
Jan 27, 2015, 10:04:02 AM1/27/15
to vcap...@cloudfoundry.org
Thanks for tagging this one, Guillaume. The READMEs for Ruby, Python and Nodejs we out of date and have been updated. The master documentation is being updated currently.

The buildpack-packager gem is used by the Ruby, Python, Nodejs and Go buildpacks, because we are wrapping upstream code to work in disconnected environments. 

Java and the new PHP buildpack are independent greenfield implementations and each has their own build mechanism.

Cheers,

JC.
Reply all
Reply to author
Forward
0 new messages