Switch jenkins to project-config

Change-Id: If7b98d6d842946c0f7e9c4925834117e7a833313
This commit is contained in:
James E. Blair 2014-09-19 15:28:40 -07:00
parent 8347b74ace
commit def93bc086
5 changed files with 34 additions and 17 deletions

View File

@ -112,6 +112,7 @@ node 'review-dev.openstack.org' {
# Node-OS: precise # Node-OS: precise
node 'jenkins.openstack.org' { node 'jenkins.openstack.org' {
class { 'openstack_project::jenkins': class { 'openstack_project::jenkins':
project_config_repo => 'https://git.openstack.org/openstack-infra/project-config',
jenkins_jobs_password => hiera('jenkins_jobs_password', 'XXX'), jenkins_jobs_password => hiera('jenkins_jobs_password', 'XXX'),
jenkins_ssh_private_key => hiera('jenkins_ssh_private_key_contents', 'XXX'), jenkins_ssh_private_key => hiera('jenkins_ssh_private_key_contents', 'XXX'),
ssl_cert_file_contents => hiera('jenkins_ssl_cert_file_contents', 'XXX'), ssl_cert_file_contents => hiera('jenkins_ssl_cert_file_contents', 'XXX'),

View File

@ -5,7 +5,8 @@ class jenkins::job_builder (
$username = '', $username = '',
$password = '', $password = '',
$git_revision = 'master', $git_revision = 'master',
$git_url = 'https://git.openstack.org/openstack-infra/jenkins-job-builder' $git_url = 'https://git.openstack.org/openstack-infra/jenkins-job-builder',
$config_dir = '',
) { ) {
# A lot of things need yaml, be conservative requiring this package to avoid # A lot of things need yaml, be conservative requiring this package to avoid
@ -40,6 +41,19 @@ class jenkins::job_builder (
ensure => directory, ensure => directory,
} }
file { '/etc/jenkins_jobs/config':
ensure => directory,
owner => 'root',
group => 'root',
mode => '0755',
recurse => true,
purge => true,
force => true,
source => $config_dir,
require => File['/etc/jenkins_jobs'],
notify => Exec['jenkins_jobs_update'],
}
exec { 'jenkins_jobs_update': exec { 'jenkins_jobs_update':
command => 'jenkins-jobs update --delete-old /etc/jenkins_jobs/config', command => 'jenkins-jobs update --delete-old /etc/jenkins_jobs/config',
timeout => '600', timeout => '600',

View File

@ -15,7 +15,8 @@ class openstack_project::jenkins (
$ssl_chain_file_contents = '', $ssl_chain_file_contents = '',
$jenkins_ssh_private_key = '', $jenkins_ssh_private_key = '',
$zmq_event_receivers = [], $zmq_event_receivers = [],
$sysadmins = [] $sysadmins = [],
$project_config_repo = '',
) { ) {
include openstack_project include openstack_project
@ -116,25 +117,18 @@ class openstack_project::jenkins (
} }
if $manage_jenkins_jobs == true { if $manage_jenkins_jobs == true {
class { 'project_config':
url => $project_config_repo,
}
class { '::jenkins::job_builder': class { '::jenkins::job_builder':
url => "https://${vhost_name}/", url => "https://${vhost_name}/",
username => $jenkins_jobs_username, username => $jenkins_jobs_username,
password => $jenkins_jobs_password, password => $jenkins_jobs_password,
git_revision => $jenkins_git_revision, git_revision => $jenkins_git_revision,
git_url => $jenkins_git_url, git_url => $jenkins_git_url,
} config_dir => $::project_config::jenkins_job_builder_config_dir,
require => $::project_config::config_dir,
file { '/etc/jenkins_jobs/config':
ensure => directory,
owner => 'root',
group => 'root',
mode => '0755',
recurse => true,
purge => true,
force => true,
source =>
'puppet:///modules/openstack_project/jenkins_job_builder/config',
notify => Exec['jenkins_jobs_update'],
} }
file { '/etc/default/jenkins': file { '/etc/default/jenkins':

View File

@ -5,6 +5,7 @@
class openstack_project::slave_common( class openstack_project::slave_common(
$include_pypy = false, $include_pypy = false,
$sudo = false, $sudo = false,
$project_config_repo = 'https://git.openstack.org/openstack-infra/project-config',
){ ){
vcsrepo { '/opt/requirements': vcsrepo { '/opt/requirements':
ensure => latest, ensure => latest,
@ -13,6 +14,10 @@ class openstack_project::slave_common(
source => 'https://git.openstack.org/openstack/requirements', source => 'https://git.openstack.org/openstack/requirements',
} }
class { 'project_config':
url => $project_config_repo,
}
file { '/usr/local/jenkins/slave_scripts': file { '/usr/local/jenkins/slave_scripts':
ensure => directory, ensure => directory,
owner => 'root', owner => 'root',
@ -21,8 +26,9 @@ class openstack_project::slave_common(
recurse => true, recurse => true,
purge => true, purge => true,
force => true, force => true,
require => File['/usr/local/jenkins'], require => [File['/usr/local/jenkins'],
source => 'puppet:///modules/openstack_project/slave_scripts', $::project_config::config_dir],
source => $::project_config::jenkins_scripts_dir,
} }
file { '/home/jenkins/.pydistutils.cfg': file { '/home/jenkins/.pydistutils.cfg':

View File

@ -31,5 +31,7 @@ class project_config(
} }
} }
$jenkins_job_builder_config_dir = "/etc/project-config/${base}jenkins/jobs"
$jenkins_scripts_dir = "/etc/project-config/${base}jenkins/scripts"
$zuul_layout_dir = "/etc/project-config/${base}zuul" $zuul_layout_dir = "/etc/project-config/${base}zuul"
} }