Skip to content

Commit

Permalink
Add documentation about slave failure due to slow performance
Browse files Browse the repository at this point in the history
Signed-off-by: Josh Barker <[email protected]>
  • Loading branch information
josh-barker committed Oct 25, 2018
1 parent 7a72f00 commit 04e9416
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 11 deletions.
5 changes: 3 additions & 2 deletions kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ provisioner:
mirror: https://updates.jenkins.io
runit:
sv_timeout: 30
# Set httpKeepAliveTimeout to 5 minutes so that connections are not closed too early.
# This can happen when there is slow performance
# This is to help slaves to connect to the master
# Sometimes with slow performance the connection is dropped/cut too early
# 30 seconds was too low, so I bumped it to 5 minutes
# https://issues.jenkins-ci.org/browse/JENKINS-38623
jenkins_args: '--httpKeepAliveTimeout=300000'

Expand Down
5 changes: 5 additions & 0 deletions test/fixtures/cookbooks/jenkins_slave/attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@
when 'rhel', 'amazon'
default['sshd_service'] = 'sshd'
end

# launch timeout is 2 minutes so that there's plenty of time for
# the slave to connect to the master

default['jenkins_slave']['launch_timeout'] = 120
2 changes: 1 addition & 1 deletion test/fixtures/cookbooks/jenkins_slave/recipes/connect.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# SSH specific attributes
host 'localhost'
credentials 'jenkins-ssh-password'
launch_timeout 120
launch_timeout node['jenkins_slave']['launch_timeout']
ssh_retries 5
ssh_wait_retries 60
end
Expand Down
6 changes: 3 additions & 3 deletions test/fixtures/cookbooks/jenkins_slave/recipes/create_ssh.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
# SSH specific attributes
host 'localhost'
credentials credentials
launch_timeout 120
launch_timeout node['jenkins_slave']['launch_timeout']
ssh_retries 5
ssh_wait_retries 60
end
Expand All @@ -90,7 +90,7 @@
# SSH specific attributes
host 'localhost'
credentials '38537014-ec66-49b5-aff2-aed1c19e2989'
launch_timeout 120
launch_timeout node['jenkins_slave']['launch_timeout']
ssh_retries 5
ssh_wait_retries 60
end
Expand All @@ -104,7 +104,7 @@
# SSH specific attributes
host 'localhost'
credentials 'jenkins-ssh-password'
launch_timeout 120
launch_timeout node['jenkins_slave']['launch_timeout']
ssh_retries 5
ssh_wait_retries 60
end
3 changes: 2 additions & 1 deletion test/fixtures/cookbooks/jenkins_slave/recipes/disconnect.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@

jenkins_ssh_slave 'ssh-to-disconnect' do
remote_fs '/tmp/ssh-to-disconnect'
user 'jenkins-ssh-password'
# SSH specific attributes
host 'localhost'
credentials 'jenkins-ssh-password'
launch_timeout 120
launch_timeout node['jenkins_slave']['launch_timeout']
ssh_retries 5
ssh_wait_retries 60
end
Expand Down
3 changes: 2 additions & 1 deletion test/fixtures/cookbooks/jenkins_slave/recipes/offline.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@

jenkins_ssh_slave 'ssh-to-offline' do
remote_fs '/tmp/ssh-to-offline'
user 'jenkins-ssh-password'
# SSH specific attributes
host 'localhost'
credentials 'jenkins-ssh-password'
launch_timeout 120
launch_timeout node['jenkins_slave']['launch_timeout']
ssh_retries 5
ssh_wait_retries 60
end
Expand Down
3 changes: 2 additions & 1 deletion test/fixtures/cookbooks/jenkins_slave/recipes/online.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@

jenkins_ssh_slave 'ssh-to-online' do
remote_fs '/tmp/ssh-to-online'
user 'jenkins-ssh-password'
# SSH specific attributes
host 'localhost'
credentials 'jenkins-ssh-password'
launch_timeout 120
launch_timeout node['jenkins_slave']['launch_timeout']
ssh_retries 5
ssh_wait_retries 60
end
Expand Down
9 changes: 7 additions & 2 deletions test/fixtures/cookbooks/jenkins_smoke/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@

raise 'Jenkins is starting up' if response.include?('Starting Jenkins')

# after Jenkins has started the slaves will connect, but this can take some time
# So we check all the slaves are online before running inspec
# After Jenkins has started the slaves will connect, but this can take some time
# So we check that the expected slaves are online before running Inspec

[
'jnlp-builder',
'jnlp-executor',
Expand All @@ -99,6 +100,10 @@
raise "cannot find slave: #{slave}" unless json_body
raise "slave: #{slave} isn't online" if json_body[:offline]
end

# Note:
# Testing that slaves are connected and/or online is prone to failure
# due to slow performance, different virtualization, etc
rescue StandardError
# re-raise exceptions so that the ruby_block triggers a retry
raise
Expand Down
5 changes: 5 additions & 0 deletions test/integration/jenkins_smoke/controls/jenkins_slave.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
# copyright: 2018, The Authors

title 'Jenkins Slaves'

# Note:
# Testing that slaves are connected and/or online is prone to failure
# due to slow performance, different virtualization, etc

control 'jenkins_slave-1.0' do
impact 0.7
title 'Jenkins JNLP Slaves are created and configured'
Expand Down

0 comments on commit 04e9416

Please sign in to comment.