system-config/modules/jenkins/manifests/slave.pp
Clark Boylan abc5b00d63 Capture testr log files when testr is used.
When testr is the test runner that is used capture the subunit stream
log file, convert it to pretty html output and publish both the log and
html file to static.openstack.org.

Change-Id: I0b79e048d25f2a8bc7cca6adf583d788809c7f05
Reviewed-on: https://review.openstack.org/17964
Reviewed-by: Monty Taylor <mordred@inaugust.com>
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Approved: James E. Blair <corvus@inaugust.com>
Reviewed-by: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
2012-12-12 21:51:01 +00:00

194 lines
4.4 KiB
Puppet

# == Class: jenkins::slave
#
class jenkins::slave(
$ssh_key = '',
$sudo = false,
$bare = false,
$user = true,
) {
include pip
if ($user == true) {
class { 'jenkins::jenkinsuser':
ensure => present,
sudo => $sudo,
ssh_key => $ssh_key,
}
}
# Packages that all jenkins slaves need
$common_packages = [
'default-jdk', # jdk for building java jobs
'build-essential',
'ccache',
'python-netaddr', # Needed for devstack address_in_net()
]
# Packages that most jenkins slaves (eg, unit test runners) need
$standard_packages = [
'asciidoc', # for building gerrit/building openstack docs
'curl',
'docbook-xml', # for building openstack docs
'docbook5-xml', # for building openstack docs
'docbook-xsl', # for building openstack docs
'firefox', # for selenium tests
'libapache2-mod-wsgi',
'libcurl4-gnutls-dev',
'libldap2-dev',
'libmysqlclient-dev',
'libsqlite3-dev',
'libxml2-dev',
'libxml2-utils', # for xmllint, need for wadl
'libxslt1-dev',
'maven2',
'pandoc', #for docs, markdown->docbook, bug 924507
'pyflakes',
'python-libvirt',
'python-subunit', # for subunit2html.py
'python-zmq', # zeromq unittests (not pip installable)
'python3-all-dev',
'rubygems',
'sqlite3',
'unzip',
'xsltproc', # for building openstack docs
'xvfb', # for selenium tests
]
if ($bare == false) {
$packages = [$common_packages, $standard_packages]
} else {
$packages = $common_packages
}
package { $packages:
ensure => present,
}
if ($bare == false) {
$gem_packages = [
'puppet-lint',
'puppetlabs_spec_helper',
]
package { $gem_packages:
ensure => latest,
provider => gem,
require => Package['rubygems'],
}
}
# Packages that need to be installed from pip
$pip_packages = [
'setuptools-git',
'tox',
]
package { $pip_packages:
ensure => latest, # we want the latest from these
provider => pip,
require => Class[pip],
}
package { 'git-review':
ensure => '1.17',
provider => pip,
require => Class[pip],
}
file { '/etc/profile.d/rubygems.sh':
ensure => present,
owner => 'root',
group => 'root',
mode => '0644',
source => 'puppet:///modules/jenkins/rubygems.sh',
}
file { '/usr/local/bin/gcc':
ensure => link,
target => '/usr/bin/ccache',
require => Package['ccache'],
}
file { '/usr/local/bin/g++':
ensure => link,
target => '/usr/bin/ccache',
require => Package['ccache'],
}
file { '/usr/local/bin/cc':
ensure => link,
target => '/usr/bin/ccache',
require => Package['ccache'],
}
file { '/usr/local/bin/c++':
ensure => link,
target => '/usr/bin/ccache',
require => Package['ccache'],
}
if ($bare == false) {
class {'mysql::server':
config_hash => {
'root_password' => 'insecure_slave',
'default_engine' => 'MyISAM',
'bind_address' => '127.0.0.1',
}
}
include mysql::server::account_security
mysql::db { 'openstack_citest':
user => 'openstack_citest',
password => 'openstack_citest',
host => 'localhost',
grant => ['all'],
require => [
Class['mysql::server'],
Class['mysql::server::account_security'],
],
}
}
file { '/usr/local/jenkins':
ensure => directory,
owner => 'root',
group => 'root',
mode => '0755',
}
file { '/usr/local/jenkins/slave_scripts':
ensure => directory,
owner => 'root',
group => 'root',
mode => '0755',
recurse => true,
require => File['/usr/local/jenkins'],
source => 'puppet:///modules/jenkins/slave_scripts',
}
file { '/etc/sudoers.d/jenkins-sudo-grep':
ensure => present,
source => 'puppet:///modules/jenkins/jenkins-sudo-grep.sudo',
owner => 'root',
group => 'root',
mode => '0440',
}
# Temporary for debugging glance launch problem
# https://lists.launchpad.net/openstack/msg13381.html
file { '/etc/sysctl.d/10-ptrace.conf':
ensure => present,
source => 'puppet:///modules/jenkins/10-ptrace.conf',
owner => 'root',
group => 'root',
mode => '0444',
}
exec { 'ptrace sysctl':
subscribe => File['/etc/sysctl.d/10-ptrace.conf'],
refreshonly => true,
command => '/sbin/sysctl -p /etc/sysctl.d/10-ptrace.conf',
}
}