With Puppet:
puppet module install rtyler-jenkins
puppet apply -v -e "include jenkins"
The following Jenkins Plugins should be considered:
- RVM - manage ruby environments
- Warnings - capture Puppet-Lint analysis
- Promoted Builds - manage job lifecycle
- HTML Publisher - capture RDoc
- CloudSmith's StackHammer - run tests on metal
Use RVM to provision Ruby environments. Recommended to use bundler to provision Gemspec.
Here is an example Gemfile file version locked to versions that are known to work with Ruby 1.8.7
source "http://rubygems.org"
gem "puppet", "=2.7.17"
gem "ci_reporter", "=1.7.0"
gem "rspec-puppet", "=0.1.3"
gem "puppet-lint", "=0.1.13"
Note: At this point in time, the latest available puppet-lint gem has some issues with Ruby 1.9
If this is at the root of your module's SCM checkout, you enable and you add an Execute Shell build step with the following:
bundle install
Add an Execute Shell build step with the following:
for file in $(find . -iname '*.pp’)
do
puppet parser validate \
--render-as s \
--modulepath=modules \
"$file" || exit 1;
done
Add an Execute Shell build step with the following:
find . -iname *.pp -exec puppet-lint --log-format "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}" {} \;
Add a “Scan for compiler �warnings” Post-Build Action with a Puppet-lint parser in �“Scan console log”
Configure Rakefile for ci_reporter by adding the following line
require 'ci/reporter/rake/rspec'
Add an Execute Shell build step with the following:
export CI_REPORTS=results
rake ci:setup:rspec spec
Add a “Publish JUnit test result report” Post-Build Action with the following pattern:
**/results/SPEC-*.xml
Add an Execute Shell build step with the following:
## Cleanup old docs.
[ -d doc/ ] && rm -rf doc/
## Dummy manifests folder.
! [ -d manifests/ ] && mkdir manifests/
## Generate docs
puppet doc --mode rdoc --manifestdir manifests/ --modulepath ./modules/ --outputdir doc
## Fix docs to remove the complete workspace from all file paths.
if [ -d ${WORKSPACE}/doc/files/${WORKSPACE}/modules ]; then
mv -v "${WORKSPACE}/doc/files/${WORKSPACE}/modules" "${WORKSPACE}/doc/files/modules"
fi
grep -l -R ${WORKSPACE} * | while read fname; do perl -pi -e "s@${WORKSPACE}/@/@g" $fname; done
Add a Publish HTML Reports post build action with the following:
-
HTML directory to archive:
doc
-
Index page(s):
index.html
-
Report title:
Puppet Docs
- http://cloudbees.com/
- http://jenkins-ci.org/
- http://rvm.io/
- http://puppet-lint.com/
- http://rspec-puppet.com/
- http://gembundler.com/
- https://wiki.jenkins-ci.org/display/JENKINS/RVM+Plugin
- https://wiki.jenkins-ci.org/display/JENKINS/Warnings+Plugin
- https://wiki.jenkins-ci.org/display/JENKINS/HTML+Publisher+Plugin
- https://wiki.jenkins-ci.org/display/JENKINS/Promoted+Builds+Plugin