[chef] setting up a continuous integration system with Chef... (not going so well so far)


Chronological Thread 
  • From: phil swenson < >
  • To: ,
  • Subject: [chef] setting up a continuous integration system with Chef... (not going so well so far)
  • Date: Fri, 14 Mar 2014 17:24:12 -0600

I posted about this yesterday, I’m going to post again - but this time with links to code.

Here is the code:


My goal is to be able to install java, oracle DB, jenkins server, install jenkins slaves, create jobs, update jobs with Chef Solo on a system of 15 servers.  1 server will be the jenkins master and the other 14 will be slaves.

I’m starting my recipe with java and jenkins installs.

I’m guessing I’m doing several things wrong:

I ended up configuring the java attributes in nodes/redstone.json as I couldn’t get them to work inside my recipe.  It seems to me it would be better to do this in my recipe as this will not be node specific, I want it global.

Here is what happens with the current code (even with include_recipe "java::default”
as suggested by Christopher Armstrong)

Any help, suggestions, critiques would be greatly appreciated.  Links to real-life projects would be great, almost everything I see is completely trivial or just doc on attributes for recipes.  I’d love to see a real life project I could download and execute.  

I have to get this going soon or my boss will pull the plug :(  


Thanks!
phil

here is the output for running the current code:


:~/dev/chef/myfirstcookbook (master)$ knife solo cook
WARNING: solo.rb found, but since knife-solo v0.3.0 it is not used any more
WARNING: Please read the upgrade instructions: https://github.com/matschaffer/knife-solo/wiki/Upgrading-to-0.3.0
Running Chef on redstone...
Checking Chef version...
Installing Berkshelf cookbooks to '/Users/philswenson/.berkshelf/knife-solo/35c024dd80a9ab482eadf86b98a86fb90c9521d7'...
Using myfirstcookbook (0.1.0)
Using jenkins (2.0.2)
Using git (3.1.0)
Using java (1.20.0)
Using apt (2.3.8)
Using runit (1.5.10)
Using build-essential (2.0.0)
Using yum (3.1.4)
Using yum-epel (0.3.4)
Using dmg (2.2.0)
Using windows (1.30.0)
Using chef_handler (1.1.5)
Uploading the kitchen...
cannot delete non-empty directory: main
WARNING: Local role_path './roles' does not exist
WARNING: Local data_bag_path './data_bags' does not exist
WARNING: Local environment_path './environments' does not exist
Generating solo config...
Running Chef...
Starting Chef Client, version 11.10.4
[2014-03-14T19:07:47-04:00] WARN: unable to detect ip6address
Compiling Cookbooks...
HI PHIL HI PHIL

================================================================================
Recipe Compile Error in /root/chef-solo/cookbooks-3/main/recipes/default.rb
================================================================================


NoMethodError
-------------
undefined method `[]' for nil:NilClass


Cookbook Trace:
---------------
  /root/chef-solo/cookbooks-2/java/recipes/oracle.rb:38:in `from_file'
  /root/chef-solo/cookbooks-2/java/recipes/default.rb:22:in `from_file'
  /root/chef-solo/cookbooks-3/main/recipes/default.rb:8:in `from_file'


Relevant File Content:
----------------------
/root/chef-solo/cookbooks-2/java/recipes/oracle.rb:

 31:
 32:  case node['java']['jdk_version'].to_s
 33:  when "6"
 34:    tarball_url = node['java']['jdk']['6'][arch]['url']
 35:    tarball_checksum = node['java']['jdk']['6'][arch]['checksum']
 36:    bin_cmds = node['java']['jdk']['6']['bin_cmds']
 37:  when "7"
 38>>   tarball_url = node['java']['jdk']['7'][arch]['url']
 39:    tarball_checksum = node['java']['jdk']['7'][arch]['checksum']
 40:    bin_cmds = node['java']['jdk']['7']['bin_cmds']
 41:  end
 42:
 43:  if tarball_url =~ /example.com/
 44:    Chef::Application.fatal!("You must change the download link to your private repository. You can no longer download java directly from http://download.oracle.com without a web broswer")
 45:  end
 46:
 47:  include_recipe "java::set_java_home"




Running handlers:
[2014-03-14T19:07:47-04:00] ERROR: Running exception handlers
Running handlers complete

[2014-03-14T19:07:47-04:00] ERROR: Exception handlers complete
[2014-03-14T19:07:47-04:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated in 0.279135717 seconds
[2014-03-14T19:07:47-04:00] ERROR: undefined method `[]' for nil:NilClass
[2014-03-14T19:07:47-04:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
ERROR: RuntimeError: chef-solo failed. See output above.
:~/dev/chef/myfirstcookbook (master)$



Archive powered by MHonArc 2.6.16.

§