Thor is a lot like Rake - they are both task management tools like Make
or Ant. These tools are great for building, testing, and releasing your
software.
The Thor integration is useful if on your build server you use Thorfiles
to automate your build process. It enables you to require our integration
tasks into your own Thorfile and then invoke the tasks as if they were your
own. This is nice because you don't leave the current executing process.
It's just a clean way of doing things.
For example:
let's say you are using Ant on your build server. You shell out to
Berkshelf to install it's dependencies. You then need to check the exit
code from that shell out to know if you should continue executing.
If we were using Thor instead of Ant you could put this line at the top of
your file:
require 'berkshelf/thor'
And then within one of your task definitions you could put a line like
this to install the dependencies:
invoke("berkshelf:install")
If the install fails it will exit the entire process with a helpful
message and exit code that we have defined.
Thor is an amazing piece of software. It allows us to create a CLI
application and tasks like these without writing any additional code.
--
Jamie Winsor
@resetexistence
reset (Jamie Stormbreaker) · GitHub
On Tuesday, June 26, 2012 at 3:12 AM, Bryan Berry wrote:
very cool!
I am still quite a ruby n00b. What is the purpose of the thor integration?
On Tue, Jun 26, 2012 at 11:23 AM, Jamie Winsor jamie@vialstudios.comwrote:
You pretty much hit the key difference there - centralized storage.
We set out to create a tool which would allow us to develop our cookbooks
rapidly and make them first class citizens on a build server. The first
task was pretty easy since @mitchellh (Vagrant) did all of that work for
us.
The second goal was a bit tougher; we had to integrate with a build
process for two different types of jobs.
One job is a cookbook job and the other is an application. In the case of
a cookbook build job your CI server listens for changes in version control
and then goes to work. We added the 'metadata' keyword which allows
Berkshelf to resolve the current working project's dependencies much like
Bundler's 'gemspec' function.
The other job is an application who has an 'application cookbook'. In this
case every application contains a Berksfile which contains only one source
entry pointing to the application's cookbook.
We have some additional things coming which will make Berkshelf more of a
Bundler / RubyGems hybrid, but until then this is the basis of what we
needed to accomplish to unblock our continuous delivery pipeline.
We'll be improving portability and adding Windows support in the next
release by dropping Gecode. You can expect some big fixes along the way and
additional features to follow after we finish up a pure Ruby constraint
solver in 0.4.0.
--
Jamie Winsor
@resetexistence
reset (Jamie Stormbreaker) · GitHub
On Tuesday, June 26, 2012 at 2:08 AM, Bryan Berry wrote:
Hey Jamie,
Awesome work!
How does berkshelf compare to librarian-chef?
afaict, it uses a different mechanism to store and link to them, this gets
around the issue of when you want to edit a cookbook managed by librarian,
you can't really do that w/out using :path and then librarian-chef install && librarian-chef update
You've also got groups which looks like a very
neat feature
What else is different?
On Mon, Jun 25, 2012 at 11:42 PM, Jamie Winsor jamie@vialstudios.comwrote:
DNS fail on my part.
You'll want to hit http://berkshelf.com until the CNAME for www is
working properly.
Sorry for the confusion!
--
Jamie Winsor
@resetexistence
reset (Jamie Stormbreaker) · GitHub
On Monday, June 25, 2012 at 12:39 PM, Jamie Winsor wrote:
Chefs,
We (Riot Games) have been hard at work these last few months setting up a
continuous delivery process for not only our software, but also for the
cookbooks that configure our software. Today we open sourced the first of a
line of tools which we will be rolling out to the community.
Berkshelf is a way to manage a cookbook or an application's cookbook
dependencies. It allows you to treat cookbooks like you treat gems. At Riot
we are using Berkshelf on every internal application. A Berksfile is
included in each application with a strict version lock to ensure we only
deploy our build artifacts with the proper accompanying cookbook version.
Given an application "league" it is accompanied by a Berksfile containing
the line:
cookbook "league", git: "git@github.riotgames.com:riot/league.git",
branch: "~> 1.61.0"
This ensures that during each build we always deploy the latest and
greatest patches of the cookbook we deem appropriate for deploying the
built artifact.
Berkshelf is also good for setting up a continuous delivery process for
your Cookbooks themselves, too. At Riot every cookbook is stored in it's
own Git repository which contains a Berksfile containing the line:
metadata
This marks the current working directory as being a cookbook itself for
Berkshelf to take actions upon. These jobs will unit test, lint test,
validate syntax, and then upload the cookbook to our Chef Server for
consumption by other applications.
We hope that you find Berkshelf as useful as we do.
http://www.berkshelf.com.
GitHub - berkshelf/berkshelf: A Chef Cookbook manager
Pull requests welcome!
--
Jamie Winsor
@resetexistence
reset (Jamie Stormbreaker) · GitHub