-
Notifications
You must be signed in to change notification settings - Fork 5
/
1-verify-tarballs
executable file
·99 lines (95 loc) · 3.1 KB
/
1-verify-tarballs
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/bash
. release-common.sh
dotest () {
ver=$(ver_tag $branch)
file=$client-$ver-$data_rel.$rhel.$arch.tar.gz
if [ -e $file ]; then
echo "Testing $client-$ver-$data_rel.$rhel.$arch..."
size=$(du -m "$file" | cut -f 1)
if [ $size -lt $min_size ]; then
echo -e "\e[1;33mWARNING: $client-$ver-$data_rel.$rhel.$arch is too small. Check with release manager.\e[0m"
elif [ $size -gt $max_size ]; then
echo -e "\e[1;33mWARNING: $client-$ver-$data_rel.$rhel.$arch is too big. Check with release manager.\e[0m"
else
echo -e "\e[1;32mOK: $client-$ver-$data_rel.$rhel.$arch is the right size.\e[0m"
fi
packages="perl yum-utils"
if type docker > /dev/null; then
if [ $rhel = el7 ]; then
image="centos:7"
elif [ $rhel = el8 ]; then
image="almalinux:8"
packages="$packages python36"
elif [ $rhel = el9 ]; then
image="almalinux:9"
else
echo "Unknown Red Hat version: $rhel"
exit 1
fi
tmp_working_dir=$(mktemp -d "${TMPDIR:-/tmp}/test-tarball-XXXXXX")
mkdir -p ${tmp_working_dir}
cp -p $file ${tmp_working_dir}
myuid=$(id -u)
cat > ${tmp_working_dir}/test-tarball.sh <<EOF
#!/bin/bash
echo "Installing $packages..."
yum install -y $packages > /dev/null 2>&1
echo "Extracting tarball..."
tar xzf $file
$client/osg/osg-post-install
$client/osgrun osg-ca-manage setupCA --url osg
$client/osgrun osg-update-vos
rm -rf $client
EOF
chmod 755 ${tmp_working_dir}/test-tarball.sh
echo "Testing in $image Docker container..."
docker run -it --rm \
-v "$tmp_working_dir:/working:rw" \
-e "myuid=$myuid" \
-w /working \
$image sh -c './test-tarball.sh'
rm -rf ${tmp_working_dir}
else
mkdir -p $rhel-$arch
pushd $rhel-$arch
tar xzf ../$file
$client/osg/osg-post-install
$client/osgrun osg-ca-manage setupCA --url osg
$client/osgrun osg-update-vos
popd
rm -rf $rhel-$arch
fi
else
echo -e "\e[1;31mERROR: $(pwd)/$client-$ver-$data_rel.$rhel.$arch tarball is missing.\e[0m"
fi
}
echo "Enter the directory containing the tarballs:"
read tarball_directory
if [ ! -d $tarball_directory ]; then
echo "Directory not found: $tarball_directory"
exit 1
fi
pushd $tarball_directory
for branch in ${versions[@]}; do
# drop upcoming from versions since they don't get their own tarballs
if [[ $branch = *-upcoming ]]; then
continue
fi
rhels=$(osg_dvers $branch)
clients="osg-wn-client"
data_rel="1"
if [ $DATA -ne 0 ]; then
data_rel="$DATA"
fi
for client in $clients; do
for rhel in $rhels; do
min_size=24
max_size=40
archs="x86_64"
for arch in $archs; do
dotest
done
done
done
done
popd