Skip to content


Optional heap and permgen args for java VM #1

merged 2 commits into from

2 participants


Allow optional $jenkins_max_heap_size and $jenkins_max_perm_size vars to control heap and permgen sizes in Jenkins Java VM via java command line args.


$jenkins_max_heap_size = "6G"
$jenkins_max_perm_size = "512M"
include jenkins

Both variables are optional. Arguments to java are only added if the corresponding variable is set.


Thanks for your contribution! I tried a few things but I also was not able to set the variables (I am a puppet noob in fact...).


Noob also. I'll see if I can get help on IRC. Also reading puppet tutorial and have one more idea to try. If I figure it out, I'll update and re-open this PR.

@toolbear toolbear closed this
@toolbear toolbear reopened this

Figured it out. Updated the PR.

@bilke bilke merged commit b104022 into bilke:master

@toolbear Where do you define the variables? For me they seem to be out of scope in config.pp (with a value of undef) no matter where I define them (I tried in my personal config under modules/people/manifests and also in manifests/site.pp).


Sorry for late reply. I noticed that it was merged, but missed your comment asking about it.

For me, defining them in a node block in manifests/site.pp works:

node 'vendacious.local' {
  # core modules, needed for most things
  include dnsmasq

  # jenkins
  $jenkins_max_heap_size = "6G"
  $jenkins_max_perm_size = "512M"
  include java
  include jenkins


The values had to be assigned prior to include jenkins. I didn't try setting them in modules/people/manifests. My (limited) understanding of variable scoping in puppet is that these have to be defined in the block, or containing block, of the include jenkins for it to work.

I'm not particularly pleased how this works, but that it works at all is a step forward, I feel.


Yes I also assigned the values prior to include jenkins.

Thanks, defining it in a node block works for me too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 7, 2013
  1. @toolbear
  2. @toolbear

    consistent indentation

    toolbear committed
Showing with 11 additions and 3 deletions.
  1. +2 −0 manifests/config.pp
  2. +9 −3 templates/dev.jenkins.plist.erb
2 manifests/config.pp
@@ -13,4 +13,6 @@
$accesslogfile = "${nginx::config::logdir}/jenkins.access.log"
$errorlogfile = "${nginx::config::logdir}/jenkins.error.log"
$port = 18080
+ $max_heap_size = $jenkins_max_heap_size
+ $max_perm_size = $jenkins_max_perm_size
12 templates/dev.jenkins.plist.erb
@@ -16,13 +16,19 @@
- <key>JENKINS_HOME</key>
- <string><%= scope.lookupvar "jenkins::config::datadir" %></string>
+ <key>JENKINS_HOME</key>
+ <string><%= scope.lookupvar "jenkins::config::datadir" %></string>
+ <%- if scope.lookupvar "jenkins::config::max_heap_size" -%>
+ <string>-Xmx<%= scope.lookupvar "jenkins::config::max_heap_size" %></string>
+ <%- end -%>
+ <%- if scope.lookupvar "jenkins::config::max_perm_size" -%>
+ <string>-XX:MaxPermSize=<%= scope.lookupvar "jenkins::config::max_perm_size" %></string>
+ <%- end -%>
<string><%= scope.lookupvar "jenkins::config::warfile" %></string>
@@ -45,4 +51,4 @@
<string><%= scope.lookupvar "jenkins::config::consolefile" %></string>
Something went wrong with that request. Please try again.