Hashar has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/125991

Change subject: contint: compress Jenkins console logs once per day
......................................................................

contint: compress Jenkins console logs once per day

The console logs of all builds are saved on the Jenkins master and pill
up a bunch of disk space overtime.  This add a daily task at 3am UTC to
compress console logs that are older than a day via gzip.  Jenkins knows
how to read the resulting log.gz files.

Bug: 63939
Change-Id: If2370a82f2e49ffcde47a8659f68a52314923cae
---
M manifests/role/ci.pp
A modules/jenkins/manifests/maintenance/compressconsolelogs.pp
2 files changed, 22 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/91/125991/1

diff --git a/manifests/role/ci.pp b/manifests/role/ci.pp
index 33c5469..6c4e4b9 100644
--- a/manifests/role/ci.pp
+++ b/manifests/role/ci.pp
@@ -19,6 +19,11 @@
     include ::jenkins,
         contint::proxy_jenkins
 
+    # Compress old console log (bug 63939)
+    class { 'jenkins::maintenance::compressconsolelogs':
+        require => Class['jenkins']
+    }
+
     # .gitconfig file required for rare git write operations
     git::userconfig { '.gitconfig for jenkins user':
         homedir => '/var/lib/jenkins',
diff --git a/modules/jenkins/manifests/maintenance/compressconsolelogs.pp 
b/modules/jenkins/manifests/maintenance/compressconsolelogs.pp
new file mode 100644
index 0000000..8f0cee5
--- /dev/null
+++ b/modules/jenkins/manifests/maintenance/compressconsolelogs.pp
@@ -0,0 +1,17 @@
+# == Class jenkins::maintenance::compressconsolelogs
+#
+# Include this class to have console logs on master jenkins to be compressed
+# via gzip.
+#
+class jenkins::maintenance::compressconsolelogs {
+
+    cron { 'jenkins compress console logs':
+        # File modified more than one day ago
+        command => '/usr/bin/nice -n 19 /usr/bin/find /var/lib/jenkins/jobs 
-mtime +1 -wholename \'*/builds/*/log\' -type f -exec gzip --best {} \;',
+        user    => 'jenkins',
+        weekday => '*',
+        hour    => 3,
+        minute  => 0,
+    }
+
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/125991
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If2370a82f2e49ffcde47a8659f68a52314923cae
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Hashar <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to