Skip to content

Commit 9b6f4b0

Browse files
committed
fixup! ansible: automatic clean-up of binary_tmp repo
1 parent c0a483f commit 9b6f4b0

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

ansible/roles/jenkins-workspace/files/clean_binary_tmp.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
cd ~binary_tmp/binary_tmp.git
44
(echo; date) >> ~binary_tmp/clean_binary_tmp.log
5+
du -sh ~binary_tmp/binary_tmp.git/ >> ~binary_tmp/clean_binary_tmp.log
56

67
git fetch origin +master:master
78

89
for b in $(git branch | sed /\*/d); do
9-
if [ -z "$(git log -1 --since='4 weeks ago' -s $b)" ]; then
10-
(git branch -D $b || true) |& tee -a ~binary_tmp/clean_binary_tmp.log
10+
if [ -z "$(git log -1 --since='7 days ago' -s $b)" ]; then
11+
(git branch -D $b |& tee -a ~binary_tmp/clean_binary_tmp.log) || true
1112
fi
1213
done
1314

ansible/roles/jenkins-workspace/tasks/main.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,13 @@
9696
group: "binary_tmp"
9797
mode: 0755
9898

99-
- name: Schedule clean-up script to run weekly
99+
- name: Schedule clean-up script to run daily
100100
lineinfile:
101-
line: "0 5 * * 0 binary_tmp ~binary_tmp/clean_binary_tmp.sh"
101+
line: "0 5 * * * binary_tmp ~binary_tmp/clean_binary_tmp.sh"
102102
dest: "/etc/crontab"
103103
regexp: "clean_binary_tmp"
104+
105+
- name: Disable automatic garbage collection
106+
command: "git config gc.auto 0"
107+
args:
108+
chdir: "~binary_tmp/binary_tmp.git/"

0 commit comments

Comments
 (0)