Repository navigation
Expand file tree
/
Copy pathtest-verify-repo.sh
More file actions
executable file
·106 lines (100 loc) · 2.82 KB
/
Copy pathtest-verify-repo.sh
File metadata and controls
executable file
·106 lines (100 loc) · 2.82 KB
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
100
101
102
103
104
105
106
#!/bin/bash
#
# Usage: test-verify-repo.sh 6.0.0
#
# It try to verify whether fluent-package is installable or not
# from test/experimental/6, test/experimental/lts/6 and so on.
#
# You can customize test targets via environment variables.
#
# REPO_TARGETS: It specify the target repositories (e.g. lts/5, lts/6, exp/6, exp/lts/6)
# DEB_TARGETS: It specify the target debian releases (e.g. debian:trixie, ubuntu:noble)
# If you want to skip it, set DEB_TARGETS=dummy
# RPM_TARGETS: It specify the target RHEL compatible releases (e.g. almalinux:8)
# If you want to skip it, set RPM_TARGETS=dummy
#
# Case 1: test recent v5/LTS
#
# REPO_TARGETS=lts/5 ./test-verify-repo.sh 5.0.8
#
# Case 2: test recent v6/LTS (only deb) on test/experimental/lts/6
#
# REPO_TARGETS=exp/lts/6 RPM_TARGETS=dummy ./test-verify-repo.sh 6.0.0
#
# Case 3: test recent v6/LTS (only rpm) on test/experimental/lts/6
#
# REPO_TARGETS=exp/lts/6 DEB_TARGETS=dummy ./test-verify-repo.sh 6.0.0
#
function test_deb() {
for d in $DEB_TARGETS; do
if [ $d = "dummy" ]; then
continue
fi
for r in $REPO_TARGETS; do
echo "TEST: on $d $r"
LOG=logs/install-${d/:/-}-on-${r//\//-}.log
docker run --rm -v $(pwd):/host $DOCKER_CLI_EXTRA_OPTIONS $d /host/test-install-in-docker.sh $USER $r $VERSION 2>&1 | tee $LOG
if [ ${PIPESTATUS[0]} -eq 0 ]; then
RESULTS="$RESULTS\nOK: $d $r"
else
RESULTS="$RESULTS\nNG: $d $r"
fi
done
done
}
function test_rpm() {
for d in $RPM_TARGETS; do
if [ $d = "dummy" ]; then
continue
fi
for r in $REPO_TARGETS; do
echo "TEST: on $d $r"
LOG=logs/install-${d/:/-}-on-${r//\//-}.log
docker run --rm -v $(pwd):/host $DOCKER_CLI_EXTRA_OPTIONS $d /host/test-install-in-docker.sh $USER $r $VERSION 2>&1 | tee $LOG
if [ ${PIPESTATUS[0]} -eq 0 ]; then
RESULTS="$RESULTS\nOK: $d $r"
else
RESULTS="$RESULTS\nNG: $d $r"
fi
done
done
}
if [ $# -ne 1 ]; then
echo "Usage: test-verify-repo 5.0.3"
exit 1
fi
VERSION=$1
if [ -z "$REPO_TARGETS" ]; then
REPO_TARGETS="exp/6 exp/lts/6"
fi
if [ -z "$DEB_TARGETS" ]; then
case $REPO_TARGETS in
*6*)
DEB_TARGETS="debian:bookworm debian:trixie ubuntu:jammy ubuntu:noble ubuntu:resolute"
;;
*5*)
DEB_TARGETS="debian:bullseye debian:bookworm ubuntu:focal ubuntu:jammy ubuntu:noble"
;;
esac
fi
if [ -z "$RPM_TARGETS" ]; then
case $REPO_TARGETS in
*6*)
RPM_TARGETS="rockylinux:8 almalinux:9 almalinux:10 amazonlinux:2023"
;;
*5*)
RPM_TARGETS="rockylinux:8 almalinux:9 amazonlinux:2 amazonlinux:2023"
;;
esac
fi
echo "DEB_TARGETS: $DEB_TARGETS"
echo "RPM_TARGETS: $RPM_TARGETS"
echo "REPO_TARGETS: $REPO_TARGETS"
# give a grace period to terminate (Ctrl+C)
sleep 3
RESULTS=""
mkdir -p logs
test_deb
test_rpm
grep "Failed to install" logs/install-*.log
echo -e $RESULTS