Skip to content

Commit 2bb2038

Browse files
committed
Use tag file to restart release tests
We now create a tag file after each succesful test of a release archive and this mean we can restart from the last successful tests and not restest everything. Azure and/or the network are rather flaky lately so this way we can run the full release matrix even if it means restarting the test command several times. Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
1 parent a0d4d81 commit 2bb2038

1 file changed

Lines changed: 68 additions & 51 deletions

File tree

etc/release/scancode-create-release.sh

Lines changed: 68 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -65,34 +65,42 @@ function run_app_smoke_tests {
6565

6666
echo " "
6767
echo "### Testing app with Python $python_app_dot_version on OS: $operating_system"
68-
archive_to_test=$(ls -1 -R release/archives/ | grep "$python_app_version-$operating_system")
6968

70-
echo "#### Testing $archive_to_test with Python $python_app_dot_version on OS: $operating_system"
69+
# check if the tag file exist meaning we have already completed the tests
70+
tag_file="scancode-release-tested-for-python-$python_app_dot_version-$operating_system"
71+
if [ ! -f $tag_file ]; then
72+
archive_to_test=$(ls -1 -R release/archives/ | grep "$python_app_version-$operating_system")
7173

72-
# Check checksum of archive and script since it transits through file.io
73-
sha_arch=$(sha256sum release/archives/$archive_to_test | awk '{ print $1 }')
74-
sha_py=$(sha256sum etc/release/scancode_release_tests.py | awk '{ print $1 }')
74+
echo "#### Testing $archive_to_test with Python $python_app_dot_version on OS: $operating_system"
7575

76-
echo "#### Creating a temp archive that contains the tested archive: $archive_file and the test script"
77-
archive_file=input.tar.gz
78-
tar -czf $archive_file \
79-
-C release/archives $archive_to_test \
80-
-C ../../etc/release scancode_release_tests.py
76+
# Check checksum of archive and script since it transits through file.io
77+
sha_arch=$(sha256sum release/archives/$archive_to_test | awk '{ print $1 }')
78+
sha_py=$(sha256sum etc/release/scancode_release_tests.py | awk '{ print $1 }')
8179

82-
tar -tvf $archive_file
80+
echo "#### Creating a temp archive that contains the tested archive: $archive_file and the test script"
81+
archive_file=input.tar.gz
82+
tar -czf $archive_file \
83+
-C release/archives $archive_to_test \
84+
-C ../../etc/release scancode_release_tests.py
8385

84-
echo "#### Remote test command: python scancode_release_tests.py app $archive_to_test sha_arch:$sha_arch sha_py:$sha_py"
86+
tar -tvf $archive_file
8587

86-
romp \
87-
--interpreter cpython \
88-
--architecture x86_64 \
89-
--check-period 5 \
90-
--version $python_app_dot_version \
91-
--platform $operating_system \
92-
--archive-file $archive_file \
93-
--command "python scancode_release_tests.py app $archive_to_test $sha_arch $sha_py"
88+
echo "#### Remote test command: python scancode_release_tests.py app $archive_to_test sha_arch:$sha_arch sha_py:$sha_py"
9489

95-
echo "#### RELEASE TEST: Completed App tests of $archive_to_test with Python $python_app_dot_version on OS: $operating_system"
90+
romp \
91+
--interpreter cpython \
92+
--architecture x86_64 \
93+
--check-period 5 \
94+
--version $python_app_dot_version \
95+
--platform $operating_system \
96+
--archive-file $archive_file \
97+
--command "python scancode_release_tests.py app $archive_to_test $sha_arch $sha_py"
98+
99+
echo "#### RELEASE TEST: Completed App tests of $archive_to_test with Python $python_app_dot_version on OS: $operating_system"
100+
touch $tag_file
101+
else
102+
echo "#### RELEASE TEST: NOT RE-TESTING $archive_to_test with Python $python_app_dot_version on OS: $operating_system"
103+
fi
96104
}
97105

98106

@@ -109,46 +117,55 @@ function run_pypi_smoke_tests {
109117
python_dot_versions=$2
110118
operating_systems=$3
111119

120+
# check if the tag file exist meaning we have already completed the tests
121+
tag_file="scancode-release-pypi-tested-for-$archive_to_test"
122+
112123
echo " "
113124
echo "### Testing $archive_to_test with Pythons: $python_dot_versions on OSses: $operating_systems"
114125

115-
# Check checksum of archive and script since it transits through file.io
116-
sha_arch=$(sha256sum release/pypi/$archive_to_test | awk '{ print $1 }')
117-
sha_py=$(sha256sum etc/release/scancode_release_tests.py | awk '{ print $1 }')
126+
if [ ! -f $tag_file ]; then
118127

119-
echo "#### Creating a temp archive that contains the tested archive: $archive_file and the test script"
120-
archive_file=input.tar.gz
121-
tar -czf $archive_file \
122-
-C release/pypi $archive_to_test \
123-
-C ../../etc/release scancode_release_tests.py
128+
# Check checksum of archive and script since it transits through file.io
129+
sha_arch=$(sha256sum release/pypi/$archive_to_test | awk '{ print $1 }')
130+
sha_py=$(sha256sum etc/release/scancode_release_tests.py | awk '{ print $1 }')
124131

125-
tar -tvf $archive_file
132+
echo "#### Creating a temp archive that contains the tested archive: $archive_to_test and the test script: release scancode_release_tests.py"
133+
archive_file=input.tar.gz
134+
tar -czf $archive_file \
135+
-C release/pypi $archive_to_test \
136+
-C ../../etc/release scancode_release_tests.py
126137

127-
echo "#### Remote test command: python scancode_release_tests.py pypi archive_to_test:$archive_to_test sha_arch:$sha_arch sha_py:$sha_py"
138+
tar -tvf $archive_file
128139

129-
# build options for Python versions and OS
130-
ver_opts=" "
131-
for pdv in $python_dot_versions
132-
do
133-
ver_opts="$ver_opts --version $pdv"
134-
done
140+
echo "#### Remote test command: python scancode_release_tests.py pypi archive_to_test:$archive_to_test sha_arch:$sha_arch sha_py:$sha_py"
135141

136-
os_opts=" "
137-
for os in $operating_systems
138-
do
139-
os_opts="$os_opts --platform $os"
140-
done
142+
# build options for Python versions and OS
143+
ver_opts=" "
144+
for pdv in $python_dot_versions
145+
do
146+
ver_opts="$ver_opts --version $pdv"
147+
done
141148

142-
romp \
143-
--interpreter cpython \
144-
--architecture x86_64 \
145-
--check-period 5 \
146-
$ver_opts \
147-
$os_opts \
148-
--archive-file $archive_file \
149-
--command "python scancode_release_tests.py pypi $archive_to_test $sha_arch $sha_py"
149+
os_opts=" "
150+
for os in $operating_systems
151+
do
152+
os_opts="$os_opts --platform $os"
153+
done
150154

151-
echo "#### RELEASE TEST: Completed PyPI tests of $archive_to_test with Pythons: $python_dot_versions on OSses: $operating_systems"
155+
romp \
156+
--interpreter cpython \
157+
--architecture x86_64 \
158+
--check-period 5 \
159+
$ver_opts \
160+
$os_opts \
161+
--archive-file $archive_file \
162+
--command "python scancode_release_tests.py pypi $archive_to_test $sha_arch $sha_py"
163+
164+
echo "#### RELEASE TEST: Completed PyPI tests of $archive_to_test with Pythons: $python_dot_versions on OSses: $operating_systems"
165+
touch $tag_file
166+
else
167+
echo "#### RELEASE TEST: NOT RE-TESTING Pypi $archive_to_test with Python $python_app_dot_version on OSses: $operating_systems"
168+
fi
152169

153170
}
154171

0 commit comments

Comments
 (0)