[chef] Re: Re: Re: multiple oracle JDK versions (7&8) using the community JAVA cookbook


Chronological Thread 
  • From: niristotle okram < >
  • To:
  • Subject: [chef] Re: Re: Re: multiple oracle JDK versions (7&8) using the community JAVA cookbook
  • Date: Wed, 13 May 2015 15:58:11 -0700

i think, i spoke too fast.... i destroyed the kitchen and re-converged. I don't see both the specified JDK's :(  only the JDK 7 was available in the server. 

jvm]$ ll
total 4
lrwxrwxrwx 1 root root   24 May 13 23:00 java -> /usr/lib/jvm/jdk1.7.0_71
drwxr-xr-x 8 root root 4096 Sep 27  2014 jdk1.7.0_71


Below is a part of the recipe <my_jenkins::jenkins_slave>

.
.
.
.
.

include_recipe 'java'

#adding the below to test the JDK8 installation
java_ark "oracle-jdk8-x86_64" do
  url node['java']['jdk']['8']['x86_64']['url']
  checksum node['java']['jdk']['8']['x86_64']['checksum']
  app_home 'java_home/oracle-jdk8-x86_64'
  action :install
end

.
.
.
.
.
.


Log from the console when i re- converge the kitchen. 


Recipe: java::set_java_home       
  * ruby_block[set-env-java-home] action run       [2015-05-13T23:34:09+01:00] INFO: Processing ruby_block[set-env-java-home] action run (java::set_java_home line 19) (skipped due to not_if)       
  * directory[/etc/profile.d] action create       [2015-05-13T23:34:09+01:00] INFO: Processing directory[/etc/profile.d] action create (java::set_java_home line 26)        (up to date)
  * file[/etc/profile.d/jdk.sh] action create       [2015-05-13T23:34:09+01:00] INFO: Processing file[/etc/profile.d/jdk.sh] action create (java::set_java_home line 30)        (up to date)
       Recipe: java::oracle
  * java_ark[jdk] action install       [2015-05-13T23:34:09+01:00] INFO: Processing java_ark[jdk] action install (java::oracle line 53)        (up to date)
  * java_alternatives[set-java-alternatives] action set       [2015-05-13T23:34:09+01:00] INFO: Processing java_alternatives[set-java-alternatives] action set (/tmp/kitchen/cookbooks/java/providers/ark.rb line 219)        (up to date)

<<--- Till here the community cookbook ran

--->> here the added code for the java_ark to install the jdk8 started
Recipe: my_jenkins::jenkins_slave       
  * java_ark[oracle-jdk8-x86_64] action install       [2015-05-13T23:34:11+01:00] INFO: Processing java_ark[oracle-jdk8-x86_64] action install (my_jenkins::jenkins_slave line 30)
       [2015-05-13T23:34:11+01:00] WARN: Cloning resource attributes for java_alternatives[set-java-alternatives] from prior resource (CHEF-3694)
       [2015-05-13T23:34:11+01:00] WARN: Previous java_alternatives[set-java-alternatives]: /tmp/kitchen/cookbooks/java/providers/ark.rb:219:in `block in class_from_file'
       [2015-05-13T23:34:11+01:00] WARN: Current  java_alternatives[set-java-alternatives]: /tmp/kitchen/cookbooks/java/providers/ark.rb:219:in `block in class_from_file'
        (up to date)
  * java_alternatives[set-java-alternatives] action set       [2015-05-13T23:34:11+01:00] INFO: Processing java_alternatives[set-java-alternatives] action set (/tmp/kitchen/cookbooks/java/providers/ark.rb line 219)
 (up to date)   





But no trace of JDK8 found in the server


























On Wed, May 13, 2015 at 2:58 PM, niristotle okram < " target="_blank"> > wrote:
Thanks for the directions. 

So your are using the lwrp from the java cookbook. With this approach, did you end up installing the default OpenJDK6 as well? Even if its yes, it won't hurt anything to me with Openjdk 6, just curious to know. In your cookbook with this recipe https://github.com/erichelgeson/jenkins-chef-dsl/blob/master/recipes/build-jdks.rb , which JDK version is the default (which version of jdk is linked to  from '/usr/lib/jvm/java') ? 
Is it the OpenJDK 6 that was installed by default from your java cookbook?



I tested like so, i still have the attributes\default.rb have the below (to install the jdk7)

default['java']['install_flavor'] = 'oracle'
default['java']['jdk_version'] = '7'
default['java']['oracle']['accept_oracle_download_terms'] = true


Then in my recipe, the below lines were added to add the JDK8 on the jenkins servers


include_recipe 'java'

#adding the below to test the JDK8 installation
java_ark "oracle-jdk8-x86_64" do
  url node['java']['jdk']['8']['x86_64']['url']
  checksum node['java']['jdk']['8']['x86_64']['checksum']
  app_home 'java_home/oracle-jdk8-x86_64'
  action :install
end



Now, i see both the jdk7 and jdk8 under /usr/lib/jvm 

jvm]$ ll
total 8
lrwxrwxrwx 1 root root   24 May 13 21:56 java -> /usr/lib/jvm/jdk1.7.0_71
drwxr-xr-x 8 root root 4096 Sep 27  2014 jdk1.7.0_71
drwxr-xr-x 8 root root 4096 Sep 18  2014 jdk1.8.0_25


in this case, the jdk7 turns be the default, as the $JAVA_HOME is set as '/usr/lib/jvm/java/'  & i can go ahead and define the jdk on the jenkins UI as below


Inline image 1











On Wed, May 13, 2015 at 1:14 PM, Eric Helgeson < " target="_blank"> > wrote:


On Wed, May 13, 2015 at 3:05 PM, niristotle okram < " target="_blank"> > wrote:
So, for the heck of trying i added another 3 attributes 

default['java']['install_flavor'] = 'oracle'
default['java']['jdk_version'] = '8'
default['java']['oracle']['accept_oracle_download_terms'] = true

so, i have the below among other attributes

default['java']['install_flavor'] = 'oracle'
default['java']['jdk_version'] = '7'
default['java']['oracle']['accept_oracle_download_terms'] = true

default['java']['install_flavor'] = 'oracle'
default['java']['jdk_version'] = '8'
default['java']['oracle']['accept_oracle_download_terms'] = true



My kitchen converge shows only JDK8 was installed and JDK7 was ignored. 

~]$ echo $JAVA_HOME
/usr/lib/jvm/java
~]$ cd /usr/lib/jvm/
jvm]$ ll
total 4
lrwxrwxrwx 1 root root   24 May 13 20:40 java -> /usr/lib/jvm/jdk1.8.0_25
drwxr-xr-x 8 root root 4096 Sep 18  2014 jdk1.8.0_25







On Wed, May 13, 2015 at 12:42 PM, niristotle okram < " target="_blank"> > wrote:
hi, 

I use the chef community cookbook to install JDK7 on my jenkins servers. I define the below default attributes on my cookbook to install the oracle jdk7

default['java']['install_flavor'] = 'oracle'
default['java']['jdk_version'] = '7'
default['java']['oracle']['accept_oracle_download_terms'] = true


I am looking for some instructions on how to install both jdk7 and jdk8 on the build servers now. I came through this section for the same issue but didn't give a clear instruction on how to do. 


how can i set the JDK7 as the default, so that all my jenkins job use JDK7 unless i specify in the job itself to use jdk8?



--
Regards
nirish okram



--
Regards
nirish okram




--
Regards
nirish okram



--
Regards
nirish okram



Archive powered by MHonArc 2.6.16.

§