summaryrefslogtreecommitdiffstats
path: root/update_jdn.sh
diff options
context:
space:
mode:
authorHolger Levsen <holger@layer-acht.org>2015-05-14 14:41:38 +0200
committerHolger Levsen <holger@layer-acht.org>2015-05-14 14:41:38 +0200
commita88b0f52a696e183e760f7d77e1548b4b07cb2da (patch)
tree7b1f7978e4d800c00c9eb21e709212dbea3e9648 /update_jdn.sh
parent7a0858f3ff45e67206dc1c982c7e59b6eee9b798 (diff)
downloadjenkins.debian.net-a88b0f52a696e183e760f7d77e1548b4b07cb2da.tar.xz
only updates job when there have been changes
Diffstat (limited to 'update_jdn.sh')
-rwxr-xr-xupdate_jdn.sh14
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