Jenkins cookbook(s) - recommendations


#1

Hi all -

A quick google search drums up several jenkins cookbooks - out
of curiosity - what have people used or does everyone write their own?

I’ve found five or six unique cookbooks which is why I’m asking…


#2

i used Fletcher Nichol cookbook, he makes great stuff with quality.

regards,
Sebastian

2012/7/19 Maven User maven.2.user@gmail.com

Hi all -

A quick google search drums up several jenkins cookbooks - out
of curiosity - what have people used or does everyone write their own?

I’ve found five or six unique cookbooks which is why I’m asking…


#3

I used that cookbook but had to make a few changes to get it to work for
myself (I also wanted the latest jenkins). The biggest issue was the groovy
script for setting up a slave (what a pain…).

On Thu, Jul 19, 2012 at 9:56 AM, Sebastian Wendel
s.wendel@sourceindex.dewrote:

i used Fletcher Nichol cookbook, he makes great stuff with quality.

https://github.com/fnichol/chef-jenkins

regards,
Sebastian

2012/7/19 Maven User maven.2.user@gmail.com

Hi all -

A quick google search drums up several jenkins cookbooks - out
of curiosity - what have people used or does everyone write their own?

I’ve found five or six unique cookbooks which is why I’m asking…


-Bryan


#4

What did you change in the groovy script and which way did you launch it?

jnlp? ssh?

On Thu, Jul 19, 2012 at 11:02 AM, Bryan Baugher bjbq4d@gmail.com wrote:

I used that cookbook but had to make a few changes to get it to work for
myself (I also wanted the latest jenkins). The biggest issue was the groovy
script for setting up a slave (what a pain…).

On Thu, Jul 19, 2012 at 9:56 AM, Sebastian Wendel <s.wendel@sourceindex.de

wrote:

i used Fletcher Nichol cookbook, he makes great stuff with quality.

https://github.com/fnichol/chef-jenkins

regards,
Sebastian

2012/7/19 Maven User maven.2.user@gmail.com

Hi all -

A quick google search drums up several jenkins cookbooks - out
of curiosity - what have people used or does everyone write their own?

I’ve found five or six unique cookbooks which is why I’m asking…


-Bryan


#5

heh - the “#”'s in the groovy file are not making jenkins happy…

First I’ll pull them all out…


#6

Other problem(s) were the package names were wrong.

There didn’t seem to be a jenkins.slaves.* but there is a hudson.slaves.*

Still no slave added to our cluster…

Still digging…

On Thu, Oct 11, 2012 at 9:04 PM, Maven User maven.2.user@gmail.com wrote:

heh - the “#”'s in the groovy file are not making jenkins happy…

First I’ll pull them all out…


#7

a few other things…

I had to log into jenkins and make sure it is listening on a particular
jnlp port.

Also - there was a way to pass through credentials to the groovy script
that I had to add…

Still digging…

On Thu, Oct 11, 2012 at 9:13 PM, Maven User maven.2.user@gmail.com wrote:

Other problem(s) were the package names were wrong.

There didn’t seem to be a jenkins.slaves.* but there is a hudson.slaves.*

Still no slave added to our cluster…

Still digging…

On Thu, Oct 11, 2012 at 9:04 PM, Maven User maven.2.user@gmail.comwrote:

heh - the “#”'s in the groovy file are not making jenkins happy…

First I’ll pull them all out…


#8

It really looks like someone did a search/replace/rename - anything that
was “hudson” to “jenkins” with this cookbook - which borks MUCH of it…

I’m still finding little bits and pieces that are wrong…

On Thu, Oct 11, 2012 at 9:49 PM, Maven User maven.2.user@gmail.com wrote:

a few other things…

I had to log into jenkins and make sure it is listening on a particular
jnlp port.

Also - there was a way to pass through credentials to the groovy script
that I had to add…

Still digging…

On Thu, Oct 11, 2012 at 9:13 PM, Maven User maven.2.user@gmail.comwrote:

Other problem(s) were the package names were wrong.

There didn’t seem to be a jenkins.slaves.* but there is a hudson.slaves.*

Still no slave added to our cluster…

Still digging…

On Thu, Oct 11, 2012 at 9:04 PM, Maven User maven.2.user@gmail.comwrote:

heh - the “#”'s in the groovy file are not making jenkins happy…

First I’ll pull them all out…


#9

That and also how the “node name” is defaulting to FQDN - not always does
dns register the name of a vm. Setting that to ipaddress solved my last
hurdle and I was able to create a new jenkins slave successfully.

Sorry about all the postings here - I’m hoping someone else can also follow
my trail if they need help. At some point, I’ll submit a pull request :-/

On Fri, Oct 12, 2012 at 1:39 AM, Maven User maven.2.user@gmail.com wrote:

It really looks like someone did a search/replace/rename - anything that
was “hudson” to “jenkins” with this cookbook - which borks MUCH of it…

I’m still finding little bits and pieces that are wrong…

On Thu, Oct 11, 2012 at 9:49 PM, Maven User maven.2.user@gmail.comwrote:

a few other things…

I had to log into jenkins and make sure it is listening on a particular
jnlp port.

Also - there was a way to pass through credentials to the groovy script
that I had to add…

Still digging…

On Thu, Oct 11, 2012 at 9:13 PM, Maven User maven.2.user@gmail.comwrote:

Other problem(s) were the package names were wrong.

There didn’t seem to be a jenkins.slaves.* but there is a hudson.slaves.*

Still no slave added to our cluster…

Still digging…

On Thu, Oct 11, 2012 at 9:04 PM, Maven User maven.2.user@gmail.comwrote:

heh - the “#”'s in the groovy file are not making jenkins happy…

First I’ll pull them all out…


#10

I’m really struggling with the slave setup - do you have any tips?

On Thu, Jul 19, 2012 at 11:02 AM, Bryan Baugher bjbq4d@gmail.com wrote:

I used that cookbook but had to make a few changes to get it to work for
myself (I also wanted the latest jenkins). The biggest issue was the groovy
script for setting up a slave (what a pain…).

On Thu, Jul 19, 2012 at 9:56 AM, Sebastian Wendel <s.wendel@sourceindex.de

wrote:

i used Fletcher Nichol cookbook, he makes great stuff with quality.

https://github.com/fnichol/chef-jenkins

regards,
Sebastian

2012/7/19 Maven User maven.2.user@gmail.com

Hi all -

A quick google search drums up several jenkins cookbooks - out
of curiosity - what have people used or does everyone write their own?

I’ve found five or six unique cookbooks which is why I’m asking…


-Bryan


#11

I keep hitting this:

================================================================================

Recipe Compile Error in
/var/chef/cache/cookbooks/chef-jenkins/recipes/node_jnlp.rb

================================================================================
NameError

Cannot find a resource for jenkins_node on ubuntu version 12.04

Cookbook Trace:

/var/chef/cache/cookbooks/chef-jenkins/recipes/node_jnlp.rb:44:in
`from_file’

It just highlights this line:

44>> jenkins_node node[:jenkins][:node][:name] do

I have all the attributes in the role already - any suggestions?


#12

On Wednesday, October 10, 2012 at 3:31 PM, Maven User wrote:

I keep hitting this:

================================================================================

Recipe Compile Error in /var/chef/cache/cookbooks/chef-jenkins/recipes/node_jnlp.rb

================================================================================
NameError

Cannot find a resource for jenkins_node on ubuntu version 12.04

Cookbook Trace:

/var/chef/cache/cookbooks/chef-jenkins/recipes/node_jnlp.rb:44:in `from_file’

It just highlights this line:

44>> jenkins_node node[:jenkins][:node][:name] do

I have all the attributes in the role already - any suggestions?
It means what the error says, there is no resource type jenkins_node. Is there supposed to be a LWRP or resource definition that defines this?


Daniel DeLeo


#13

You’ve saved the cookbook as chef-jenkins when it is actually jenkins,
so the LWRP is being created as (probably) chef-jenkins_node

Rename the cookbook to ‘jenkins’ instead of ‘chef-jenkins’…

–AJ

On 11 October 2012 11:31, Maven User maven.2.user@gmail.com wrote:

I keep hitting this:

================================================================================

Recipe Compile Error in
/var/chef/cache/cookbooks/chef-jenkins/recipes/node_jnlp.rb

================================================================================
NameError

Cannot find a resource for jenkins_node on ubuntu version 12.04

Cookbook Trace:

/var/chef/cache/cookbooks/chef-jenkins/recipes/node_jnlp.rb:44:in
`from_file’

It just highlights this line:

44>> jenkins_node node[:jenkins][:node][:name] do

I have all the attributes in the role already - any suggestions?


#14

Would making the “name” attribute in cookbook metadata mandatory help
mitigate this kind of confusion? It’s normally inferred by the
directory name in which the cookbook is contained, which is a real
bummer when dealing with LWRPs.

On Wed, Oct 10, 2012 at 6:37 PM, AJ Christensen aj@junglist.gen.nz wrote:

You’ve saved the cookbook as chef-jenkins when it is actually jenkins,
so the LWRP is being created as (probably) chef-jenkins_node

Rename the cookbook to ‘jenkins’ instead of ‘chef-jenkins’…

–AJ

On 11 October 2012 11:31, Maven User maven.2.user@gmail.com wrote:

I keep hitting this:

================================================================================

Recipe Compile Error in
/var/chef/cache/cookbooks/chef-jenkins/recipes/node_jnlp.rb

================================================================================
NameError

Cannot find a resource for jenkins_node on ubuntu version 12.04

Cookbook Trace:

/var/chef/cache/cookbooks/chef-jenkins/recipes/node_jnlp.rb:44:in
`from_file’

It just highlights this line:

44>> jenkins_node node[:jenkins][:node][:name] do

I have all the attributes in the role already - any suggestions?


#15

I have this ticket created regarding this issue: http://tickets.opscode.com/browse/CHEF-3490


Jamie Winsor
@resetexistence

On Wednesday, October 10, 2012 at 6:27 PM, Sean OMeara wrote:

Would making the “name” attribute in cookbook metadata mandatory help
mitigate this kind of confusion? It’s normally inferred by the
directory name in which the cookbook is contained, which is a real
bummer when dealing with LWRPs.

On Wed, Oct 10, 2012 at 6:37 PM, AJ Christensen <aj@junglist.gen.nz (mailto:aj@junglist.gen.nz)> wrote:

You’ve saved the cookbook as chef-jenkins when it is actually jenkins,
so the LWRP is being created as (probably) chef-jenkins_node

Rename the cookbook to ‘jenkins’ instead of ‘chef-jenkins’…

–AJ

On 11 October 2012 11:31, Maven User <maven.2.user@gmail.com (mailto:maven.2.user@gmail.com)> wrote:

I keep hitting this:

================================================================================

Recipe Compile Error in
/var/chef/cache/cookbooks/chef-jenkins/recipes/node_jnlp.rb

================================================================================
NameError

Cannot find a resource for jenkins_node on ubuntu version 12.04

Cookbook Trace:

/var/chef/cache/cookbooks/chef-jenkins/recipes/node_jnlp.rb:44:in
`from_file’

It just highlights this line:

44>> jenkins_node node[:jenkins][:node][:name] do

I have all the attributes in the role already - any suggestions?


#16

I see this tho in the node_jnlp.rp recipe:

jenkins_node node[:jenkins][:node][:name] do
description node[:jenkins][:node][:description]
executors node[:jenkins][:node][:executors]
remote_fs node[:jenkins][:node][:home]
labels node[:jenkins][:node][:labels]
mode node[:jenkins][:node][:mode]
launcher "jnlp"
mode node[:jenkins][:node][:mode]
availability node[:jenkins][:node][:availability]end

On Wed, Oct 10, 2012 at 6:36 PM, Daniel DeLeo dan@kallistec.com wrote:

On Wednesday, October 10, 2012 at 3:31 PM, Maven User wrote:

I keep hitting this:

================================================================================

Recipe Compile Error in
/var/chef/cache/cookbooks/chef-jenkins/recipes/node_jnlp.rb

================================================================================
NameError

Cannot find a resource for jenkins_node on ubuntu version 12.04

Cookbook Trace:

/var/chef/cache/cookbooks/chef-jenkins/recipes/node_jnlp.rb:44:in
`from_file’

It just highlights this line:

44>> jenkins_node node[:jenkins][:node][:name] do

I have all the attributes in the role already - any suggestions?

It means what the error says, there is no resource type jenkins_node.
Is there supposed to be a LWRP or resource definition that defines this?


Daniel DeLeo


#17

Correct, as prior posters in this thread have mentioned, you have a
namespacing issue.

LWRPs are namespaced according to the name of the cookbook. When you
renamed the cookbook from “jenkins” to “chef-jenkins,” you renamed all
of the LWRPs along with it (LWRP == Lightweight Resource Provider, a
case where somebody has extended Chef to know about new resources
and/or providers). The Jenkins cookbook has a number of LWRPs defined
for managing Jenkins jobs and slave nodes, among other things.

Here’s the page on the Chef wiki that discusses how LWRPs work:

http://wiki.opscode.com/display/chef/Lightweight+Resources+and+Providers+(LWRP)

And here’s the specific section of the article that tells you how the
files are laid out and demonstrates the namespacing issue:

http://wiki.opscode.com/display/chef/Lightweight+Resources+and+Providers+(LWRP)#LightweightResourcesandProviders(LWRP)-FileLocations

There are two ways to solve this problem:

  • Change the name of the cookbook back to “jenkins”. Make sure you
    edit your test node’s run list.
  • Change the name of the resource in the node.jnlp.rb recipe from
    "jenkins_node" to “chef_jenkins_node” (I think dashes get converted to
    underscores…).

I prefer not to change the names on community cookbooks for this
reason unless it’s to adhere to some sort of internal namespacing
policy … in which case it ends up being a lot of extra work,
renaming attributes, resources, providers, etc. …

I do think that using the namespace generated by the cookbook is the
proper way to do things, though – we shouldn’t start letting people
define arbitrary resources using LWRP code. Imagine the
troubleshooting delight that will ensue if someone downloads a
cookbook from the community site written by some dude who decides to
override “package.”

Hope this helps you figure this out.

On Thu, Oct 11, 2012 at 8:37 AM, Maven User maven.2.user@gmail.com wrote:

I see this tho in the node_jnlp.rp recipe:

jenkins_node node[:jenkins][:node][:name] do
description node[:jenkins][:node][:description]
executors node[:jenkins][:node][:executors]
remote_fs node[:jenkins][:node][:home]
labels node[:jenkins][:node][:labels]
mode node[:jenkins][:node][:mode]
launcher "jnlp"
mode node[:jenkins][:node][:mode]
availability node[:jenkins][:node][:availability]
end

On Wed, Oct 10, 2012 at 6:36 PM, Daniel DeLeo dan@kallistec.com wrote:

On Wednesday, October 10, 2012 at 3:31 PM, Maven User wrote:

I keep hitting this:

================================================================================

Recipe Compile Error in
/var/chef/cache/cookbooks/chef-jenkins/recipes/node_jnlp.rb

================================================================================
NameError

Cannot find a resource for jenkins_node on ubuntu version 12.04

Cookbook Trace:

/var/chef/cache/cookbooks/chef-jenkins/recipes/node_jnlp.rb:44:in
`from_file’

It just highlights this line:

44>> jenkins_node node[:jenkins][:node][:name] do

I have all the attributes in the role already - any suggestions?

It means what the error says, there is no resource type jenkins_node. Is
there supposed to be a LWRP or resource definition that defines this?


Daniel DeLeo


#18

Thank you so much for taking the time to explain - and provide links!!!

Yep - so I renamed the cookbook and I’m wedged again - but not sure if this
is the right place to ask.

I can see that it’s reaching out to the server to register now, but it’s
just hanging:

java -jar /srv/jenkins/jenkins-cli.jar -s https:// groovy
node_info.groovy integrationtester

It ends with:

Exception in thread “main” java.io.EOFException: unexpected stream
termination
at
hudson.remoting.ClassicCommandTransport.create(ClassicCommandTransport.java:100)
at hudson.remoting.Channel.(Channel.java:391)
at hudson.remoting.Channel.(Channel.java:387)
at hudson.remoting.Channel.(Channel.java:348)
at hudson.remoting.Channel.(Channel.java:344)
at hudson.remoting.Channel.(Channel.java:332)
at hudson.cli.CLI.connectViaHttp(CLI.java:156)
at hudson.cli.CLI.(CLI.java:139)
at hudson.cli.CLIConnectionFactory.connect(CLIConnectionFactory.java:68)
at hudson.cli.CLI._main(CLI.java:438)
at hudson.cli.CLI.main(CLI.java:373)

I’ll keep digging…