canonical-ubuntu-qa team mailing list archive
-
canonical-ubuntu-qa team
-
Mailing list archive
-
Message #01414
[Merge] ~andersson123/autopkgtest-cloud:delete_old_github_requests into autopkgtest-cloud:master
Tim Andersson has proposed merging ~andersson123/autopkgtest-cloud:delete_old_github_requests into autopkgtest-cloud:master.
Requested reviews:
Canonical's Ubuntu QA (canonical-ubuntu-qa)
For more details, see:
https://code.launchpad.net/~andersson123/autopkgtest-cloud/+git/autopkgtest-cloud/+merge/451645
--
Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~andersson123/autopkgtest-cloud:delete_old_github_requests into autopkgtest-cloud:master.
diff --git a/charms/focal/autopkgtest-web/units/delete-old-github-requests.service b/charms/focal/autopkgtest-web/units/delete-old-github-requests.service
new file mode 100644
index 0000000..e4bec05
--- /dev/null
+++ b/charms/focal/autopkgtest-web/units/delete-old-github-requests.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=Delete github requests older than 1 day
+
+[Service]
+Type=oneshot
+User=ubuntu
+ExecStart=/home/ubuntu/webcontrol/delete-old-github-requests
diff --git a/charms/focal/autopkgtest-web/units/delete-old-github-requests.timer b/charms/focal/autopkgtest-web/units/delete-old-github-requests.timer
new file mode 100644
index 0000000..993c77f
--- /dev/null
+++ b/charms/focal/autopkgtest-web/units/delete-old-github-requests.timer
@@ -0,0 +1,8 @@
+[Unit]
+Description=Delete github requests older than 1 day (timer)
+
+[Timer]
+OnCalendar=hourly
+
+[Install]
+WantedBy=autopkgtest-web.target
diff --git a/charms/focal/autopkgtest-web/webcontrol/delete-old-github-requests b/charms/focal/autopkgtest-web/webcontrol/delete-old-github-requests
new file mode 100755
index 0000000..6569e2e
--- /dev/null
+++ b/charms/focal/autopkgtest-web/webcontrol/delete-old-github-requests
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+if find /run/autopkgtest_webcontrol/github-pending/ -mtime 1 | grep -q "."; then
+ find /run/autopkgtest_webcontrol/github-pending/ -mtime 1 -print0 | xargs rm
+ printf "github requests older than one day have now been deleted.\n"
+else
+ printf "No github requests are older than one day - not deleting anything.\n"
+fi