diff --git a/manifests/site.pp b/manifests/site.pp index 91c558853c..b276f0da24 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -112,6 +112,7 @@ node 'review-dev.openstack.org' { # Node-OS: precise node 'jenkins.openstack.org' { class { 'openstack_project::jenkins': + project_config_repo => 'https://git.openstack.org/openstack-infra/project-config', jenkins_jobs_password => hiera('jenkins_jobs_password', 'XXX'), jenkins_ssh_private_key => hiera('jenkins_ssh_private_key_contents', 'XXX'), ssl_cert_file_contents => hiera('jenkins_ssl_cert_file_contents', 'XXX'), diff --git a/modules/jenkins/manifests/job_builder.pp b/modules/jenkins/manifests/job_builder.pp index c232a33545..fafcc93287 100644 --- a/modules/jenkins/manifests/job_builder.pp +++ b/modules/jenkins/manifests/job_builder.pp @@ -5,7 +5,8 @@ class jenkins::job_builder ( $username = '', $password = '', $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 @@ -40,6 +41,19 @@ class jenkins::job_builder ( 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': command => 'jenkins-jobs update --delete-old /etc/jenkins_jobs/config', timeout => '600', diff --git a/modules/openstack_project/manifests/jenkins.pp b/modules/openstack_project/manifests/jenkins.pp index 697031deff..cc865ef63a 100644 --- a/modules/openstack_project/manifests/jenkins.pp +++ b/modules/openstack_project/manifests/jenkins.pp @@ -15,7 +15,8 @@ class openstack_project::jenkins ( $ssl_chain_file_contents = '', $jenkins_ssh_private_key = '', $zmq_event_receivers = [], - $sysadmins = [] + $sysadmins = [], + $project_config_repo = '', ) { include openstack_project @@ -116,25 +117,18 @@ class openstack_project::jenkins ( } if $manage_jenkins_jobs == true { + class { 'project_config': + url => $project_config_repo, + } + class { '::jenkins::job_builder': url => "https://${vhost_name}/", username => $jenkins_jobs_username, password => $jenkins_jobs_password, git_revision => $jenkins_git_revision, git_url => $jenkins_git_url, - } - - 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'], + config_dir => $::project_config::jenkins_job_builder_config_dir, + require => $::project_config::config_dir, } file { '/etc/default/jenkins': diff --git a/modules/openstack_project/manifests/slave_common.pp b/modules/openstack_project/manifests/slave_common.pp index bf662bbc25..bb18452d2e 100644 --- a/modules/openstack_project/manifests/slave_common.pp +++ b/modules/openstack_project/manifests/slave_common.pp @@ -5,6 +5,7 @@ class openstack_project::slave_common( $include_pypy = false, $sudo = false, + $project_config_repo = 'https://git.openstack.org/openstack-infra/project-config', ){ vcsrepo { '/opt/requirements': ensure => latest, @@ -13,6 +14,10 @@ class openstack_project::slave_common( source => 'https://git.openstack.org/openstack/requirements', } + class { 'project_config': + url => $project_config_repo, + } + file { '/usr/local/jenkins/slave_scripts': ensure => directory, owner => 'root', @@ -21,8 +26,9 @@ class openstack_project::slave_common( recurse => true, purge => true, force => true, - require => File['/usr/local/jenkins'], - source => 'puppet:///modules/openstack_project/slave_scripts', + require => [File['/usr/local/jenkins'], + $::project_config::config_dir], + source => $::project_config::jenkins_scripts_dir, } file { '/home/jenkins/.pydistutils.cfg': diff --git a/modules/project_config/manifests/init.pp b/modules/project_config/manifests/init.pp index 1f440bd152..a3cc9fd479 100644 --- a/modules/project_config/manifests/init.pp +++ b/modules/project_config/manifests/init.pp @@ -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" }