Given a puppet tree (with manifest and modules) dir
When rspec-puppet tests and puppet lint tests pass
Instead of re-running test on all possible roles
I want to calculate what roles (classes) were impacted in between revision of the puppet tree
Roles would translate to classes in puppet tree with a special prefix f.i. role_
Within a CI system - a new build gets params current and previous hash of commits. If you would run this this tool , you can know on what machines you need to run tests on. This would be determine the next stage in your current build plan (Bamboo speak)
Do an actual noop run on CI standby servers and see if things changed using detailed-exit-codes. This would require us to do a run on CI servers for all possible roles we define in our tree. And this will take time and will generate a lot of 'unneeded' puppet applies. (debatable) We want to be clever and detect only the roles that have been impacted by a change.
-
Get a list of files changed in your puppet tree F.i. mercurial get a list of files that changed in between revisions. (-S for subrepos)
hg status --rev cc01cf47d579:3951a60e401e -m -a -r -d -S
M moduleA/glbl A moduleB/...
Or git (not sure on submodules) - See http://stackoverflow.com/questions/1552340/git-show-all-changed-files-between-two-commits
- using the filename prefixes we can see what puppet modules have been impacted in between git commits
moduleA, module B are impacted
See - http://www.devco.net/archives/2012/04/28/trigger-puppet-runs.php
- Specify the current state of a node and build a catalog facts can be given (ala rspec puppet style) or using actual catalog files
See - https://github.com/ripienaar/puppet-catalog-diff See - https://github.com/rodjek/rspec-puppet/blob/master/lib/rspec-puppet/support.rb
-
for both commit-ids checkout the puppet tree either using plain commands or fancy using grit or mercurial-ruby
-
for both commit-ids calculate a list of resources/classes based on given facts Calculate the dependency tree for a role(class) and see if the roles depend on the module changed.
-
filter the resources based on a role prefix
Et voilà