Ask Your Question
2

puppet jenkins integration

asked 2014-05-15 07:42:10 -0600

Murali Krishna gravatar image

How to integrate Jenkins and puppet, Please someone help on this.

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
1

answered 2014-05-16 03:26:09 -0600

kariboe gravatar image

updated 2014-05-16 03:51:20 -0600

We have a Jenkins project with 2 build steps in our delivery pipeline that:

  • checks for syntax errors in our puppet modules
  • runs puppet-lint on all .pp files.

Step 1:

for file in $(find . -iname '*.pp'); do
  puppet parser validate --color false --render-as s --modulepath=modules $file || exit 1;
done;

Step 2:

find . -iname *.pp -exec puppet-lint --no-autoloader_layout-check --no-80chars-check --log-format "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}" {} \;

We have added an 'after build' step called 'scan for compiler warnings' and uses the Jenkins build-in Puppet-lint parser. Make sure you have puppet and puppet lint installed on your CI server.

At the moment we don't run other puppet module tests but we are planning to implement this very soon.

edit flag offensive delete link more

Comments

Thank you............ But i am using some plugins to install on jenkins like (Vagrant, puppet) to integrate on UI. But i am not able to integrate with puppet on jenkins. Can you please help us on this.

Murali Krishna gravatar imageMurali Krishna ( 2014-05-21 00:17:46 -0600 )edit
0

answered 2014-05-17 11:24:32 -0600

lfast gravatar image

There are many options for integrating Jenkins and Puppet but here's what we do:

I have separate servers running Jenkins, Puppetmaster (pm1) and nodes (n1,n2). I use Git for my puppet code In Jenkins config I declare n1,n2 & pm1 as ssh remote hosts (plugin)

Job 1: Update Puppetmaster environment - ssh build step that runs on puppetmaster - cd into puppet Environment (/etc/puppet/environments/dev22) - git pull

Job 2: Run Puppet on node n1 - ssh build step that runs on n1 - sudo puppet agent -t --environment dev22

edit flag offensive delete link more
0

answered 2014-05-19 05:38:17 -0600

Marcus gravatar image

There is a nice gem you can use for this: puppet-catalog-test

It will compile the catalog for you and can be used local (pre-commit hook) or remote in your jenkins job. Just initialize a rvm or rbenv environment in your job, install the gem and it will produce something like this (example taken from the gem's documentation:

$ puppet-catalog-test -m test/cases/working/modules -M test/cases/working/site.pp
[INFO] Using puppet 3.0.2
[PASSED]  foo (compile time: 0.168182 seconds)
[PASSED]  default (compile time: 0.003451 seconds)

----------------------------------------
Compiled 2 catalogs in 0.1717 seconds (avg: 0.0858 seconds)

puppet-catalog-test Documentation

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-05-15 07:42:10 -0600

Seen: 1,343 times

Last updated: May 19 '14