This is an automated email from the ASF dual-hosted git repository.

altay pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new 009db34  Adding beam_Clean_tmp_directory Jenkins job
     new 7ae4648  Merge pull request #12072 from damgad/tmp_cleanup
009db34 is described below

commit 009db34c655717b7d764c5a31bad76b6fedceef7
Author: Damian Gadomski <damian.gadom...@polidea.com>
AuthorDate: Mon Jun 22 18:19:18 2020 +0200

    Adding beam_Clean_tmp_directory Jenkins job
---
 .test-infra/jenkins/job_Clean_tmp_directory.groovy | 47 ++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/.test-infra/jenkins/job_Clean_tmp_directory.groovy 
b/.test-infra/jenkins/job_Clean_tmp_directory.groovy
new file mode 100644
index 0000000..6dc42fe
--- /dev/null
+++ b/.test-infra/jenkins/job_Clean_tmp_directory.groovy
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+job('beam_Clean_tmp_directory') {
+    description('Cleans /tmp directory on the node machine by removing files 
that were not accessed for long (configurable) time.')
+
+    logRotator {
+        daysToKeep(14)
+    }
+
+    concurrentBuild()
+
+    parameters {
+        labelParam('machine_label') {
+            description("Label of the machine to be cleaned. Could be either a 
specific machine name or `beam` if you want to cleanup all the machines.")
+            allNodes('allCases','AllNodeEligibility')
+        }
+        stringParam {
+            name("unaccessed_for")
+            defaultValue("10")
+            description("Only files that were not accessed for last 
`unaccessed_for` hours will be deleted. Default value should be right in most 
cases. Modify it only if know what you're doing :)")
+            trim(true)
+        }
+    }
+
+    steps {
+        shell('echo "Current size of /tmp dir is \$(sudo du -sh /tmp)"')
+        shell('echo "Deleting files accessed later than \${unaccessed_for} 
hours ago"')
+        shell('sudo find /tmp -type f -amin +\$((60*\${unaccessed_for})) 
-print -delete')
+        shell('echo "Size of /tmp dir after cleanup is \$(sudo du -sh /tmp)"')
+    }
+}

Reply via email to