Puppet, Git, Jenkins

88 views
Skip to first unread message

Sandro Roth

unread,
Oct 22, 2014, 9:18:14 AM10/22/14
to puppet...@googlegroups.com
Hi

We manage our puppet code with an internal git repo. Each module has it's own git repo and a few git hooks check for syntax and linting.
Our puppet master checks for changes in a specific branch and clones them.

It involves a few manual steps and we'd like to get rid of them with some CI intelligence in the middle. 
I have been looking and playing with Jenkins the last few days but now I seem to be stuck.

It works great when I create a Jenkins job which tracks changes in a git repo, runs the tests and if succeeded pushes the puppet module to the master.
But we have about 30 modules and creating a job for each module seems inefficient?

Maybe there is a way doing this dynamically that someone could point me to?
Or perhaps jenkins is not the right solution here for us?


Thanks for opening my eyes :)

Regards
Sandro



Atom Powers

unread,
Oct 22, 2014, 10:54:11 AM10/22/14
to puppet...@googlegroups.com
I would actually recommend creating 31 Jenkins jobs.
One for each module, which implements the test suite for that module,
and another "acceptance test" job that runs the test suite for your
collected puppet code. Probably using Beaker.

You can create jenkins jobs from it's CLI and/or API interface, and
there are plugins to import jobs from templates and such. I haven't
personally done this but I know others who have.
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/af00fb14-a8e5-4c54-9ceb-549302acfcc7%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Perfection is just a word I use occasionally with mustard.
--Atom Powers--

Javier Palacios

unread,
Oct 22, 2014, 3:14:12 PM10/22/14
to puppet...@googlegroups.com


On Wed, Oct 22, 2014 at 3:18 PM, Sandro Roth <sandr...@gmail.com> wrote:

It works great when I create a Jenkins job which tracks changes in a git repo, runs the tests and if succeeded pushes the puppet module to the master.
But we have about 30 modules and creating a job for each module seems inefficient?

Maybe there is a way doing this dynamically that someone could point me to?
Or perhaps jenkins is not the right solution here for us?


More than 'recommended', you will a jenkins job for each repo. Maybe you could circumvent it in some manner, but as far as I know, wildcards are not allowed on repository names, so you will need at least to explicitly list each of your individual repos.

Altough creating many jenkins jobs is not that hard. If by chance you are using gitlab, I'm working on the gitlab-hook plugin to allow template based automatic job creation.

But in any case, you can use the command line jenkins client (point your browser to /cli on your jenkins server). In particular, you can get the configuration of an existing job in xml format, and create/modify a job by uploading an xml file. So you have a poor man templating engine. Basically, you only need to modify the cloning url on the xml, as the job name is not written there.

Javier Palacios

Sandro Roth

unread,
Oct 23, 2014, 5:31:17 AM10/23/14
to puppet...@googlegroups.com
Thank you guys for your replies.

Yes Javier, we are in fact using gitlab ;) So let me know if we can help you with the hook scripts in any way, I'd be very interested.

In the meantime I'll look into automating the jenkins job creation with the cli and or api.
I have read about job builder which uses templates and stuff like Atom Powers mentioned.

Wildcards in git repo names is actually not possible within a jenkins job, tried that.


Cheers
Sandro

joel.m...@gmail.com

unread,
Oct 23, 2014, 6:48:59 AM10/23/14
to puppet-users
You could leverage Jenkins' plethora of plugins. Perhaps use the matrix plugin, that way you only need to detail the array of module names under test - not duplicate the jobs

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
$ echo "kpfmAdpoofdufevq/dp/vl" | perl -pe 's/(.)/chr(ord($1)-1)/ge'

Clayton O'Neill

unread,
Oct 23, 2014, 2:48:31 PM10/23/14
to puppet...@googlegroups.com
We use Jenkins Job Builder from the OpenStack project for configuring Jenkins jobs.  It's generally a lot more readable than the XML and it offers templating features: 

Reply all
Reply to author
Forward
0 new messages