Skip to content

Commit ca2a69d

Browse files
committed
Do not require the java cookbook
The Java cookbook might be overkill for most users, and it is not even a requirement for the package installer. Removing this dependency removes the tight coupling between Jenkins and Java and allows users to easily install and manage their own Java, outside of this cookbook.
1 parent a8464de commit ca2a69d

File tree

5 files changed

+49
-5
lines changed

5 files changed

+49
-5
lines changed

.kitchen.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ suites:
3636
master:
3737
install_method: package
3838
- name: jenkins_smoke_war
39-
run_list: jenkins_smoke::default
39+
run_list:
40+
- jenkins::java
41+
- jenkins_smoke::default
4042
attributes:
4143
jenkins:
4244
master:

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ The master recipe will create the required directory structure and install jenki
2424
- `package` - Install Jenkins from the official jenkins-ci.org packages
2525
- `war` - Download the latest version of the WAR file and configure it with Runit
2626

27+
### java
28+
By default, this cookbook does not install, manage, or manipulate a JDK, as that is outside of the scope of Jenkins. The `package` installation method will automatically pull in a valid Java if one does not exist, by the nature of package installers. However, the `war` installation method will require you to install a valid Java runtime. This very simple recipe installs OpenJDK 7 on the target system. **If you need a more complex Java setup, you should use the community cookbook or write your own.** For more information and warnings, please see the inline documentation in the `jenkins::java` recipe.
29+
2730

2831
Resource/Provider
2932
-----------------

metadata.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@
99
recipe 'master', 'Installs a Jenkins master'
1010

1111
depends 'apt', '~> 2.0'
12-
depends 'java', '~> 1.17'
1312
depends 'runit', '~> 1.5'
1413
depends 'yum', '~> 3.0'

recipes/java.rb

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#
2+
# Cookbook Name:: jenkins
3+
# Recipe:: java
4+
#
5+
# Author: Seth Vargo <[email protected]>
6+
#
7+
# Copyright 2014, Chef Software, Inc.
8+
#
9+
# Licensed under the Apache License, Version 2.0 (the "License");
10+
# you may not use this file except in compliance with the License.
11+
# You may obtain a copy of the License at
12+
#
13+
# http://www.apache.org/licenses/LICENSE-2.0
14+
#
15+
# Unless required by applicable law or agreed to in writing, software
16+
# distributed under the License is distributed on an "AS IS" BASIS,
17+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
# See the License for the specific language governing permissions and
19+
# limitations under the License.
20+
#
21+
# This is a very basic recipe for installing Java on the target system. It is
22+
# NOT included in any recipes by default. The purpose of this cookbook is to
23+
# install Jenkins, not manage a Java. For complex Java scenarios, you should
24+
# use the Java community cookbook or construct your own.
25+
#
26+
# Do NOT submit patches adding support for additional platforms
27+
# Do NOT submit patches adding support for installing Java derivatives
28+
# Do NOT submit patches adding support for installing different Java versions
29+
#
30+
# This recipe is not included by default, and you have no obligation to use it.
31+
# We are going to be incredibly opinionated about what this recipe includes, as
32+
# it is a minimum viable cookbook for installing Java. If you need a more
33+
# complex scenario, that is outside the scope of this cookbook.
34+
#
35+
36+
case node['platform_family']
37+
when 'debian'
38+
package 'openjdk-7-jdk'
39+
when 'rhel'
40+
package 'java-1.7.0-openjdk'
41+
else
42+
fail "`#{node['platform_family']}' is not supported!"
43+
end

recipes/master.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626
# limitations under the License.
2727
#
2828

29-
# Install Java (TODO: remove)
30-
include_recipe 'java::default'
31-
3229
# Create the Jenkins user
3330
user node['jenkins']['master']['user'] do
3431
home node['jenkins']['master']['home']

0 commit comments

Comments
 (0)