Skip to content

Commit f4c6a7e

Browse files
author
metworkbot
committed
build: sync common files from github_organization_management repository
1 parent c5478be commit f4c6a7e

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
find /home/buildcache -type f -atime +30 -exec rm -f {} \; >/dev/null 2>&1
4+
chown -RL metworkpub:metworkpub /home/buildcache
5+
chmod -R 755 /home/buildcache

.github/workflows/clean_ci.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
3+
find /pub/metwork/continuous_integration/buildlogs/ -type f -mtime +5 -exec rm -f {} \; 2>/dev/null
4+
find /pub/metwork/continuous_integration/buildlogs/ -type d -exec rmdir {} \; 2>/dev/null
5+
6+
find /pub/metwork/continuous_integration/docs/ -type f -not -path '*/integration/*' -a -not -path '*/master/*' -a -not -path '*/release_*/*' -mtime +15 -exec rm -f {} \; 2>/dev/null
7+
find /pub/metwork/continuous_integration/docs/ -type d -not -path '*/integration/*' -a -not -path '*/master/*' -a -not -path '*/release_*/*' -exec rmdir {} \; 2>/dev/null
8+
9+
BRANCHES=$(find /pub/metwork/continuous_integration/rpms/ -maxdepth 1 -mindepth 1 -type d -exec basename {} \;)
10+
for BRANCH in ${BRANCHES}; do
11+
BRANCH_SHORT=$(echo "${BRANCH}" |sed 's/release_//g')
12+
if test -L "/pub/metwork/continuous_integration/rpms/${BRANCH}"; then
13+
continue
14+
fi
15+
for OS in centos6 centos7; do
16+
DELETED=0
17+
for MODULE in mfext mfext-full mfext-${BRANCH_SHORT} mfcom mfadmin mfadmin-full mfadmin-${BRANCH_SHORT} mfbase mfbase-full mfbase-${BRANCH_SHORT} mfdata mfdata-full mfdata-${BRANCH_SHORT} mfserv mfserv-full mfserv-${BRANCH_SHORT} mfsysmon mfsysmon-full mfsysmon-${BRANCH_SHORT} mfbus mfbus-full mfbus-${BRANCH_SHORT} mfext-layer-mapserver-${BRANCH_SHORT} mfext-layer-python3_mapserverapi-${BRANCH_SHORT} mfext-layer-python2_mapserverapi-${BRANCH_SHORT} mfext-layer-scientific-${BRANCH_SHORT} mfext-layer-python3_scientific-${BRANCH_SHORT} mfext-layer-python2_scientific-${BRANCH_SHORT} mfext-layer-python3_vim-${BRANCH_SHORT} mfext-layer-python2_vim-${BRANCH_SHORT} mfext-layer-vim-${BRANCH_SHORT} mfext-layer-python3_ia-${BRANCH_SHORT} mfext-layer-python2-${BRANCH_SHORT} mfext-layer-python2_core-${BRANCH_SHORT} mfext-layer-python2_devtools-${BRANCH_SHORT} mfext-layer-scientific_system_libraries-${BRANCH_SHORT} mfext-layer-php-${BRANCH_SHORT} mfext-layer-rabbitmq_system_libraries-${BRANCH_SHORT} mfext-layer-rabbitmq-${BRANCH_SHORT} mfext-layer-scientific_system_libraries-${BRANCH_SHORT}; do
18+
echo "- Searching for ${BRANCH}/${OS}/${MODULE}/..."
19+
# We only keep rpms of the 3 last ci
20+
for N in `find /pub/metwork/continuous_integration/rpms/${BRANCH}/${OS} -type f -name "metwork-${MODULE}-${BRANCH_SHORT}.ci*.rpm" 2>/dev/null |xargs -r -n 1 basename |grep '\.ci[0-9][0-9]*\.' |sed 's/^.*\.\(ci[0-9][0-9]*\)\..*$/\1/g' |sed 's/ci//g' |sort -rn |uniq |awk 'NR>3'`; do
21+
echo " => deleting /pub/metwork/continuous_integration/rpms/${BRANCH}/${OS}/metwork-${MODULE}-${BRANCH_SHORT}.ci${N}.*.rpm"
22+
rm -f /pub/metwork/continuous_integration/rpms/${BRANCH}/${OS}/metwork-${MODULE}-${BRANCH_SHORT}.ci${N}.*.rpm
23+
DELETED=1
24+
done
25+
# For each kept ci, we only keep rpms of the 3 last builds
26+
for N in `find /pub/metwork/continuous_integration/rpms/${BRANCH}/${OS} -type f -name "metwork-${MODULE}-${BRANCH_SHORT}.ci*.rpm" 2>/dev/null |xargs -r -n 1 basename |grep '\.ci[0-9][0-9]*\.' |sed 's/^.*\.\(ci[0-9][0-9]*\)\..*$/\1/g' |sed 's/ci//g' |sort -rn |uniq`; do
27+
for M in `find /pub/metwork/continuous_integration/rpms/${BRANCH}/${OS} -type f -name "metwork-${MODULE}-${BRANCH_SHORT}.ci${N}*.rpm" 2>/dev/null |xargs -r -n 1 basename | awk -F "-" '{ print $NF }' | awk -F "." '{ print $1 }' | sort -rn | uniq |awk 'NR>3'`; do
28+
echo " => deleting /pub/metwork/continuous_integration/rpms/${BRANCH}/${OS}/metwork-${MODULE}-${BRANCH_SHORT}.ci${N}.*-${M}.gen.x86_64.rpm"
29+
rm -f /pub/metwork/continuous_integration/rpms/${BRANCH}/${OS}/metwork-${MODULE}-${BRANCH_SHORT}.ci${N}.*-${M}.gen.x86_64.rpm
30+
DELETED=1
31+
done
32+
done
33+
done
34+
if test "${DELETED}" = "1"; then
35+
cd /pub/metwork/continuous_integration/rpms/${BRANCH}/${OS} && su -c "createrepo ." metworkpub
36+
fi
37+
done
38+
done
39+
40+
for DIR in `find /pub/metwork/continuous_integration/rpms -mindepth 2 -maxdepth 2 -type d -not -path '*/integration/*' -a -not -path '*/master/*' -a -not -path '*/release_*/*'`; do
41+
echo "Searching in ${DIR}..."
42+
N=`find ${DIR} -type f -name "*.rpm" -mtime +15 2>/dev/null |wc -l`
43+
if test ${N} -gt 0; then
44+
find ${DIR} -type f -name "*.rpm" -mtime +15 -exec rm -f {} \; 2>/dev/null
45+
cd ${DIR} && su -c "createrepo ." metworkpub
46+
fi
47+
N=`find ${DIR} -type f -name "*.rpm" 2>/dev/null |wc -l`
48+
if test ${N} -eq 0; then
49+
rm -Rf ${DIR}
50+
fi
51+
done
52+
find /pub/metwork/continuous_integration/rpms -mindepth 1 -maxdepth 1 -type d -exec rmdir {} \; >/dev/null 2>&1
53+
54+
chown -RL metworkpub:metworkpub /pub/metwork
55+
chmod -R 755 /pub/metwork

0 commit comments

Comments
 (0)