Skip to content
This repository has been archived by the owner on Jan 27, 2023. It is now read-only.

Commit

Permalink
Allow custom location for slave JAVA command
Browse files Browse the repository at this point in the history
  • Loading branch information
esalberg committed Aug 2, 2018
1 parent 76b4514 commit dcc7612
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
5 changes: 4 additions & 1 deletion manifests/slave.pp
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,16 @@
# can be a String, or an Array.
#
# [*proxy_server*]
#
# Serves the same function as `::jenkins::proxy_server` but is an independent
# parameter so the `::jenkins` class does not need to be the catalog for
# slave only nodes.
#
# [*swarm_client_args*]
# Swarm client arguments to add to slave command line. More info: https://github.com/jenkinsci/swarm-plugin/blob/master/client/src/main/java/hudson/plugins/swarm/Options.java
#
# [*java_cmd*]
# Path to the java command in ${defaults_location}/jenkins-slave. Defaults to '/usr/bin/java'
#

# === Examples
#
Expand Down Expand Up @@ -140,6 +142,7 @@
Any $java_args = undef,
Any $swarm_client_args = undef,
Boolean $delete_existing_clients = false,
Any $java_cmd = '/usr/bin/java',
) inherits jenkins::params {

if versioncmp($version, '3.0') < 0 {
Expand Down
7 changes: 7 additions & 0 deletions spec/classes/jenkins_slave_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,13 @@
end
end
end # delete_existing_clients

describe 'with a non-default $java_cmd' do
let(:params) { { java_cmd: '/usr/local/bin/java' } }

it { is_expected.to contain_file(slave_runtime_file).with_content(%r{^JAVA="#{java_cmd}"$}) }
end

end

shared_examples 'using slave_name' do
Expand Down
2 changes: 1 addition & 1 deletion templates/jenkins-slave-defaults.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# this file can not be used in its current state as a systemd EnvironmentFile.

# location of java
JAVA=/usr/bin/java
JAVA=<%= @java_cmd %>

# arguments to pass to java
#JAVA_ARGS="-Xmx256m"
Expand Down

0 comments on commit dcc7612

Please sign in to comment.