forked from cms-sw/cms-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cleanup-tags
executable file
·55 lines (44 loc) · 1.41 KB
/
cleanup-tags
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh -ex
if [ X$DRY_RUN = Xtrue ]; then
ECHO=echo
fi
cd $WORKSPACE
if [ ! -d cmssw ]; then
git init cmssw
cd cmssw
git remote add origin [email protected]:cms-sw/cmssw
else
cd cmssw
fi
# Get the list of queues. Notice we need to use the date in the matching to
# avoid CMSSW_6_2_X matching CMSSW_6_2_X_SLHC
QUEUES=`git ls-remote --tags origin "CMSSW_*X*" | grep refs/tags | sed -e 's|.*refs/tags/||;s|_2[0-1][0-9][0-9]-[0-1][0-9].*||' | sort -u`
for QUEUE in $QUEUES; do
# List the tags we are going to delete.
git ls-remote --tags origin "${QUEUE}_2*" \
| head -n -30
# Keep 30 tags per QUEUE.
git ls-remote --tags origin "${QUEUE}_2*" \
| sed -e "s/.*$QUEUE/:$QUEUE/" \
| head -n -30 \
| xargs -r $ECHO git push origin
done
cd $WORKSPACE
if [ ! -d cmsdist ]; then
git init cmsdist
cd cmsdist
git remote add origin [email protected]:cms-sw/cmsdist
else
cd cmsdist
fi
CMSDIST_QUEUES=`git ls-remote --tags origin "*/CMSSW_*X*" | grep refs/tags | grep "\(ERR\|IB\|ALL\)" | sed -e 's|.*refs/tags/||;s|20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]|2*|' | sort -u`
for QUEUE in $CMSDIST_QUEUES; do
# List the tags we are going to delete.
git ls-remote --tags origin "$QUEUE" \
| head -n -30
# Keep 30 tags per QUEUE.
git ls-remote --tags origin "$QUEUE" \
| sed -e "s|.*refs/tags/|:|" \
| head -n -30 \
| xargs -r $ECHO git push origin
done