Skip to content

Commit

Permalink
vm-tests.yml: Fix distupgrade script
Browse files Browse the repository at this point in the history
Signed-off-by: Tobias Knöppler <[email protected]>
  • Loading branch information
theCalcaholic committed Apr 21, 2024
1 parent b9d67ba commit 1eddb12
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/vm-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,22 @@ jobs:
- name: NCP distupgrade
id: distupgrade
working-directory: /ncp-test-automation/bin
run: |
ssh "${SSH_OPTIONS[@]}" "root@${SERVER_ADDRESS}" cat /etc/os-release | grep VERSION_ID=11 || {
echo "Skipping dist-upgrade - can't upgrade from Debian $(lxc exec ncp -- cat /etc/os-release | grep VERSION_ID=)"
set -e
echo "Setup ssh"
eval "$(ssh-agent)"
ssh-add /github/workspace/.ssh/automation_ssh_key
source ./library.sh
ssh "${SSH_OPTIONS[@]}" "root@${SERVER_ADDRESS}" cat /etc/os-release | grep 'VERSION_ID="11"' || {
echo "Skipping dist-upgrade - can't upgrade from Debian $(ssh "${SSH_OPTIONS[@]}" "root@${SERVER_ADDRESS}" grep 'VERSION_ID=' /etc/os-release)"
echo "skipped=yes" | tee -a $GITHUB_OUTPUT
exit 0
}
ssh "${SSH_OPTIONS[@]}" "root@${SERVER_ADDRESS}" bash -c 'ncp-dist-upgrade'
ssh "${SSH_OPTIONS[@]}" "root@${SERVER_ADDRESS}" DEBIAN_FRONTEND=noninteractive ncp-dist-upgrade
echo "skipped=no" | tee -a $GITHUB_OUTPUT
- name: Run integration tests
Expand Down Expand Up @@ -307,6 +316,8 @@ jobs:
echo "==========================================="
ssh "${SSH_OPTIONS[@]}" "root@${SERVER_ADDRESS}" tail /var/log/ncp.log;
echo "==========================================="
echo "and nextcloud.log:"
ssh "${SSH_OPTIONS[@]}" "root@${SERVER_ADDRESS}" tail /opt/ncdata/data/nextcloud.log;
exit 1
}
Expand Down
18 changes: 12 additions & 6 deletions bin/ncp-dist-upgrade.d/debian-11.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
#!/bin/bash

set -eu -o pipefail
set -eux -o pipefail


new_cfg=/usr/local/etc/ncp-recommended.cfg
[[ -f "${new_cfg}" ]] || { echo "Already on the lastest recommended distribution. Abort." >&2; exit 1; }

export DEBIAN_FRONTEND=noninteractive

echo "
>>> ATTENTION <<<
This is a dangerous process that is only guaranteed to work properly if you
Expand All @@ -19,8 +17,16 @@ The current distribution will keep receiving updates for some time.
Do you want to continue? [y/N]"

read -n1 -r key
[[ "${key,,}" == y ]] || exit 0
if [[ "$DEBIAN_FRONTEND" == "noninteractive" ]]
then
echo "Noninteractive environment detected. Automatically proceeding in 30 seconds..."
sleep 30
else
read -n1 -r key
[[ "${key,,}" == y ]] || exit 0
fi

export DEBIAN_FRONTEND=noninteractive

source /usr/local/etc/library.sh
save_maintenance_mode
Expand All @@ -40,7 +46,7 @@ do
done
apt-get update && apt-get upgrade -y --without-new-pkgs
# Required to avoid breakage of /etc/resolv.conf
apt-get install -y --no-install-recommends systemd-resolved && systemctl enable --now systemd-resolved
#apt-get install -y --no-install-recommends systemd-resolved && systemctl enable --now systemd-resolved
apt-get full-upgrade -y

restore_maintenance_mode
Expand Down

0 comments on commit 1eddb12

Please sign in to comment.