Basic chef config question (java/jenkins)


#1

Hi, I’m back on my jenkins/java project…

here is the github for the Jenkins recipe:

I’m having trouble configuring the jenkins recipe. This may be a very
basic chef question.

Here is the code:

the ‘jenkins_command’ calls end up using the wrong java_home and I get an
error like:

[2014-04-02T13:56:29-04:00] ERROR: jenkins_command[safe-restart]
(main::default line 27) had an error: Errno::ENOENT: No such file or
directory - opt/java/bin/java -jar /var/chef/cache/jenkins-cli.jar -s
http://localhost:8080 safe-restart

as you can see in default.rb, I even try to set jenkins to the correct
JAVA_HOME via
node.override[:jenkins][:java_home] =
"/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home"

But Jenkins doesn’t pick up this setting.

Am I configuring this properly? Or am I missing something basic?
It also seems wrong that I can’t simply pull in the java_home form the
environment I’m targeting, rather than hardcoding…

thanks for any help!
phil


#2

Hey Phil,

From the jenkins attribute defaults you see this below, try
node.set[‘jenkins’][‘java’].

Hoep this helps.

D

The path to the +java+ bin on disk. This attribute is intelligently

calculated by assuming some sane defaults from community Java cookbooks:

- node[‘java’][‘java_home’]

- node[‘java’][‘home’]

- ENV[‘JAVA_HOME’]

These home’s are then intelligently joined with +/bin/java+ for the full

path to the Java binary. If no +$JAVA_HOME+ is detected, +‘java’+ is used

and it is assumed that the correct java binary exists in the +$PATH+.

You can override this attribute by setting the full path manually:

node.set[‘jenkins’][‘java’] = ‘/my/custom/path/to/java6’

Setting this value to +nil+ will break the Internet.

On Wed, Apr 2, 2014 at 2:03 PM, phil swenson phil.swenson@gmail.com wrote:

Hi, I’m back on my jenkins/java project…

here is the github for the Jenkins recipe:

https://github.com/opscode-cookbooks/jenkins

I’m having trouble configuring the jenkins recipe. This may be a very
basic chef question.

Here is the code:

https://github.com/pswenson/JenkinsChefRecipe/blob/master/cookbooks/main/recipes/default.rb

the ‘jenkins_command’ calls end up using the wrong java_home and I get an
error like:

[2014-04-02T13:56:29-04:00] ERROR: jenkins_command[safe-restart]
(main::default line 27) had an error: Errno::ENOENT: No such file or
directory - opt/java/bin/java -jar /var/chef/cache/jenkins-cli.jar -s
http://localhost:8080 safe-restart

as you can see in default.rb, I even try to set jenkins to the correct
JAVA_HOME via
node.override[:jenkins][:java_home] =
"/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home"

But Jenkins doesn’t pick up this setting.

Am I configuring this properly? Or am I missing something basic?
It also seems wrong that I can’t simply pull in the java_home form the
environment I’m targeting, rather than hardcoding…

thanks for any help!
phil