diff options
author | Holger Levsen <holger@layer-acht.org> | 2015-05-14 14:41:38 +0200 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2015-05-14 14:41:38 +0200 |
commit | a88b0f52a696e183e760f7d77e1548b4b07cb2da (patch) | |
tree | 7b1f7978e4d800c00c9eb21e709212dbea3e9648 /update_jdn.sh | |
parent | 7a0858f3ff45e67206dc1c982c7e59b6eee9b798 (diff) | |
download | jenkins.debian.net-a88b0f52a696e183e760f7d77e1548b4b07cb2da.tar.xz |
only updates job when there have been changes
Diffstat (limited to 'update_jdn.sh')
-rwxr-xr-x | update_jdn.sh | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/update_jdn.sh b/update_jdn.sh index a7e824b4..5130b4bb 100755 --- a/update_jdn.sh +++ b/update_jdn.sh @@ -256,14 +256,24 @@ explain "Updated user content for Jenkins." # run jenkins-job-builder to update jobs if needed # (using sudo because /etc/jenkins_jobs is root:root 700) # +STAMP=/var/log/jenkins/jobs-updated.stamp cd /srv/jenkins/job-cfg for metaconfig in *.yaml.py ; do - python $metaconfig > ${metaconfig%.py} + python $metaconfig > $TMPFILE + if ! $(diff $metaconfig $TMPFILE > /dev/null) ; then + cp $TMPFILE ${metaconfig%.py} + fi done for config in *.yaml ; do - sudo jenkins-jobs update $config + if [ $config -nt $STAMP ] || [ ! -f $STAMP ] ; then + sudo jenkins-jobs update $config + else + echo "$config has not changed, nothing to do." + fi done explain "Jenkins jobs updated." +touch $STAMP # so on the next run, only configs newer than this file will be updated +rm -f $TMPFILE # # crappy tests for checking that jenkins-job-builder works correctly |