Skip to content

Commit 3a6db55

Browse files
committed
{deb/rpm}-upgrade: simplify install/upgrade test operations
replace pattern: # comment about what we are doing that isn't in bb log if something_might_go_wrong; then log_err - it went wrong (missing error capture) exit 1 to: bb_log_info "where testing this" sometime_might_go_wrong The something_might_go_wrong in the second step will trap and have all the saving of the failure afterwards leaving the user with the info of what was being tested to provide the failure context.
1 parent bb012a2 commit 3a6db55

2 files changed

Lines changed: 16 additions & 26 deletions

File tree

scripts/deb-upgrade.sh

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -110,20 +110,16 @@ apt_get_update
110110
# We will wait till they finish, to avoid any clashes with SQL we are going to execute
111111
wait_for_mariadb_upgrade
112112

113-
if ! sudo sh -c "DEBIAN_FRONTEND=noninteractive MYSQLD_STARTUP_TIMEOUT=180 \
114-
apt-get -o Dpkg::Options::=--force-confnew install --allow-unauthenticated -y $package_list"; then
115-
bb_log_err "Installation of a previous release failed, see the output above"
116-
exit 1
117-
fi
113+
bb_log_info "Install previous version"
114+
sudo sh -c "DEBIAN_FRONTEND=noninteractive MYSQLD_STARTUP_TIMEOUT=180 \
115+
apt-get -o Dpkg::Options::=--force-confnew install --allow-unauthenticated -y $package_list"
118116

119117
wait_for_mariadb_upgrade
120118

121119
if [[ -n $spider_package_list ]]; then
122-
if ! sudo sh -c "DEBIAN_FRONTEND=noninteractive MYSQLD_STARTUP_TIMEOUT=180 \
123-
apt-get -o Dpkg::Options::=--force-confnew install --allow-unauthenticated -y $spider_package_list"; then
124-
bb_log_err "Installation of Spider from the previous release failed, see the output above"
125-
exit 1
126-
fi
120+
bb_log_info "Install spider packages"
121+
sudo sh -c "DEBIAN_FRONTEND=noninteractive MYSQLD_STARTUP_TIMEOUT=180 \
122+
apt-get -o Dpkg::Options::=--force-confnew install --allow-unauthenticated -y $spider_package_list"
127123
wait_for_mariadb_upgrade
128124
fi
129125

@@ -163,20 +159,17 @@ apt_get_update
163159
# now we upgrade, this is what we should save
164160
trap save_failure_logs ERR
165161
set -e
166-
# Install the new packages
167-
if ! sudo sh -c "DEBIAN_FRONTEND=noninteractive MYSQLD_STARTUP_TIMEOUT=180 \
168-
apt-get -o Dpkg::Options::=--force-confnew install --allow-unauthenticated -y $package_list"; then
169-
bb_log_err "installation of the new packages failed, see the output above"
170-
exit 1
171-
fi
162+
163+
bb_log_info "Install new packages"
164+
sudo sh -c "DEBIAN_FRONTEND=noninteractive MYSQLD_STARTUP_TIMEOUT=180 \
165+
apt-get -o Dpkg::Options::=--force-confnew install --allow-unauthenticated -y $package_list"
166+
172167
wait_for_mariadb_upgrade
173168

174169
if [[ -n $spider_package_list ]]; then
175-
if ! sudo sh -c "DEBIAN_FRONTEND=noninteractive MYSQLD_STARTUP_TIMEOUT=180 \
176-
apt-get -o Dpkg::Options::=--force-confnew install --allow-unauthenticated -y $spider_package_list"; then
177-
bb_log_err "Installation of the new Spider packages failed, see the output above"
178-
exit 1
179-
fi
170+
bb_log_info "Install spider packages $spider_package_list"
171+
sudo sh -c "DEBIAN_FRONTEND=noninteractive MYSQLD_STARTUP_TIMEOUT=180 \
172+
apt-get -o Dpkg::Options::=--force-confnew install --allow-unauthenticated -y $spider_package_list"
180173
wait_for_mariadb_upgrade
181174
fi
182175
if [[ $test_mode == "columnstore" ]]; then

scripts/rpm-upgrade.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,8 @@ if [[ $test_type == "major" ]] || [[ $test_mode == "columnstore" ]]; then
231231
control_mariadb_server restart
232232
fi
233233

234-
# Make sure that the new server is running
235-
if sudo mariadb -e "select @@version" | grep "$old_version"; then
236-
bb_log_err "the server was not upgraded or was not restarted after upgrade"
237-
exit 1
238-
fi
234+
bb_log_info "Make sure that the new server is running"
235+
sudo mariadb -e "select @@version" | grep "$old_version"
239236

240237
# Run mariadb-upgrade for non-GA branches (minor upgrades in GA branches
241238
# shouldn't need it)

0 commit comments

Comments
 (0)