Skip to content

Commit

Permalink
Merge pull request voxpupuli#485 from covermymeds/slave_java_args
Browse files Browse the repository at this point in the history
add ability to set java_args on slaves
  • Loading branch information
jhoblitt committed Feb 8, 2016
2 parents c538cc4 + 2d34424 commit 6a6925e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
17 changes: 17 additions & 0 deletions manifests/slave.pp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@
#
# [*manage_client_jar*]
# Should the class download the client jar file from the web? Defaults to true.
#
# [*ensure*]
# Service ensure control for jenkins-slave service. Default running
#
# [*enable*]
# Service enable control for jenkins-slave service. Default true.
#
# [*source*]
# File source for jenkins slave jar. Default pulls from http://maven.jenkins-ci.org
#
# [*java_args*]
# Java arguments to add to slave command line. Allows configuration of heap, etc.
#

# === Examples
#
Expand Down Expand Up @@ -97,9 +110,13 @@
$ensure = 'running',
$enable = true,
$source = undef,
$java_args = undef,
) inherits jenkins::params {

validate_string($tool_locations)
if $java_args {
validate_string($java_args)
}

$client_jar = "swarm-client-${version}-jar-with-dependencies.jar"
$client_url = $source ? {
Expand Down
13 changes: 13 additions & 0 deletions spec/classes/jenkins_slave_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,19 @@
should contain_file(slave_runtime_file).with_content(/^JENKINS_PASSWORD="#{password}"$/)
end
end

describe 'with java_args' do
let(:args) { '-Xmx2g' }
let(:params) do
{
:java_args => args
}
end

it 'should set java_args' do
should contain_file(slave_runtime_file).with_content(/^JAVA_ARGS="#{args}"$/)
end
end
end

shared_examples 'using slave_name' do
Expand Down
3 changes: 3 additions & 0 deletions templates/jenkins-slave-defaults.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ JAVA=/usr/bin/java
# arguments to pass to java
#JAVA_ARGS="-Xmx256m"
#JAVA_ARGS="-Djava.net.preferIPv4Stack=true" # make jenkins listen on IPv4 address
<% if @java_args -%>
JAVA_ARGS="<%= @java_args -%>"
<% end -%>

PIDFILE=/var/run/jenkins-slave/jenkins-slave.pid

Expand Down

0 comments on commit 6a6925e

Please sign in to comment.