Run jenkins jobs script only after config update.

Previously the jenkins job script was run against Jenkins during each
Puppet run. Now run the jenkins job script only if any of the job
configs or jenkins job configs change.

Change-Id: I12d6dcf56ae46de7b5f373f2e4df6214c0f59c79
This commit is contained in:
Clark Boylan 2012-07-27 09:35:05 -07:00
parent 98a0e386cd
commit 1d65e2dc3c

View File

@ -13,7 +13,8 @@ class jenkins_jobs($url, $username, $password, $site) {
ensure => 'directory', ensure => 'directory',
recurse => true, recurse => true,
source => ['puppet:///modules/jenkins_jobs/'], source => ['puppet:///modules/jenkins_jobs/'],
require => Package['python-yaml'] require => Package['python-yaml'],
notify => Exec["jenkins_job_${site}"]
} }
file { '/usr/local/jenkins_jobs/jenkins_jobs.ini': file { '/usr/local/jenkins_jobs/jenkins_jobs.ini':
@ -23,13 +24,15 @@ class jenkins_jobs($url, $username, $password, $site) {
ensure => 'present', ensure => 'present',
content => template('jenkins_jobs/jenkins_jobs.ini.erb'), content => template('jenkins_jobs/jenkins_jobs.ini.erb'),
replace => 'true', replace => 'true',
require => File['/usr/local/jenkins_jobs'] require => File['/usr/local/jenkins_jobs'],
notify => Exec["jenkins_job_${site}"]
} }
exec { "jenkins_job_${site}": exec { "jenkins_job_${site}":
command => "python /usr/local/jenkins_jobs/jenkins_jobs.py update /usr/local/jenkins_jobs/projects/${site}", command => "python /usr/local/jenkins_jobs/jenkins_jobs.py update /usr/local/jenkins_jobs/projects/${site}",
cwd => '/usr/local/jenkins_jobs/', cwd => '/usr/local/jenkins_jobs/',
path => '/bin:/usr/bin', path => '/bin:/usr/bin',
refreshonly => true,
require => [ require => [
File['/usr/local/jenkins_jobs/jenkins_jobs.ini'], File['/usr/local/jenkins_jobs/jenkins_jobs.ini'],
Package['python-jenkins'] Package['python-jenkins']