Well, Mike, the code I wrote today doesn't look at roles at all. I didn't
think too hard about mapping cookbook changes to roles, as I'd decided that
I'd implement that as a pretty simple grep. In other words:
Inbound change set includes changes to "cookbook1" -> Look up "cookbook1"
in dependency graph, find dependencies on "cookbook2" -> Look for roles
containing either "cookbook1" or "cookbook2" -> Test those roles first.
That's basically the logic I am looking to implement.
The other fun thing, which I'd thought would somehow involve me writing an
entirely new Jenkins plugin but now appears to be implementable via
ScriptTrigger, is going to be "Run Librarian, build aggregate change set."
Then run through the above parsing logic.
I'm currently supporting a unified Chef repo but hope to tool things in
such a way that individual cookbook repos get updated with each central
release. I don't know if this sounds fancy or not but the implementation
is actually not at all fancy and I feel a bit stupid for not trying this
approach earlier (basically involves a merciless application of "git
filter-branch" as part of the release job).
Honestly, the visualization came about on my way towards getting to the
JSON object, but internally everyone seems to really like the graphviz
renders. Someone even mentioned that they were using your knife plugin,
Mike!
Hmm, maybe I should be rendering the dependency graph and including it in
the yard-generated documentation site.
(working on getting the OK to contribute that back, BTW - works just as
well with individual cookbooks as it does with whole repositories...)
On Tue, Jul 9, 2013 at 10:07 PM, Mike miketheman@gmail.com wrote:
A while back, I did something similar for roles only:
knife-role-spaghetti by miketheman
Does this make my (albiet, not really touched this code in a while)
code obsolete?
-M
On Tue, Jul 9, 2013 at 8:00 PM, steve . leftathome@gmail.com wrote:
Not sure if anyone's already doing something like this, but I made some
REALLY MINOR modifications to the most ancient and venerable Ruby
depgraph
tool and got it parsing cookbook metadata instead of C# code and
installed
gems.
GitHub - leftathome/depgraph: Modified version of Ruby depgraph that parses Chef cookbook metadata.
Default behavior is to parse, fire up graphviz and show you a dependency
graph. That's fine but I wanted it as a JSON object.
I added the -json switch to allow you to generate an object that looks
like
this:
{ "cookbook" : [ "dependency1", "dependency2"],
...
}
Hope someone out there finds this useful.