Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Allow custom location for slave JAVA command #883

Merged
merged 1 commit into from
Aug 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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