From 90ef9dba5384e426919dd4d08bc08a096ed416ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Kn=C3=B6ppler?= <6317548+theCalcaholic@users.noreply.github.com> Date: Thu, 5 Sep 2024 20:22:32 +0200 Subject: [PATCH] vm-tests.yml: Fix distupgrade tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tobias Knöppler <6317548+theCalcaholic@users.noreply.github.com> --- .../create-test-instance-bullseye/action.yml | 2 +- .../actions/create-test-instance/action.yml | 2 +- .github/workflows/build-lxd.yml | 2 +- .github/workflows/vm-tests.yml | 47 +++++++++++++++++-- ncp-app/lib/Service/SettingsService.php | 1 - 5 files changed, 46 insertions(+), 8 deletions(-) diff --git a/.github/actions/create-test-instance-bullseye/action.yml b/.github/actions/create-test-instance-bullseye/action.yml index 07a8bff2..dd82d811 100644 --- a/.github/actions/create-test-instance-bullseye/action.yml +++ b/.github/actions/create-test-instance-bullseye/action.yml @@ -13,7 +13,7 @@ inputs: server_type: description: Server type to use for hetzner servers required: true - default: "cx11" + default: "cx22" outputs: server_address: diff --git a/.github/actions/create-test-instance/action.yml b/.github/actions/create-test-instance/action.yml index ff6cdb9c..26b1a730 100644 --- a/.github/actions/create-test-instance/action.yml +++ b/.github/actions/create-test-instance/action.yml @@ -13,7 +13,7 @@ inputs: server_type: description: Server type to use for hetzner servers required: true - default: "cx11" + default: "cx22" outputs: server_address: diff --git a/.github/workflows/build-lxd.yml b/.github/workflows/build-lxd.yml index 10332fb2..c5b2992a 100644 --- a/.github/workflows/build-lxd.yml +++ b/.github/workflows/build-lxd.yml @@ -541,7 +541,7 @@ jobs: sudo "$LXC" exec ncp -- /usr/local/bin/ncc status current_nc_version_new="$(sudo "$LXC" exec ncp -- ncc status | grep "version:" | awk '{ print $3 }')" - if [[ "$current_nc_version" =~ "$latest_nc_version".* ]] + if [[ "$current_nc_version_new" =~ "$latest_nc_version".* ]] then break fi diff --git a/.github/workflows/vm-tests.yml b/.github/workflows/vm-tests.yml index 74123b4c..a6cf114a 100644 --- a/.github/workflows/vm-tests.yml +++ b/.github/workflows/vm-tests.yml @@ -64,7 +64,7 @@ jobs: version: ${{ env.VERSION }} uid: "${{ env.UID }}" hcloud_token: ${{ secrets.TEST_AUTOMATION_HCLOUD_API_TOKEN }} - server_type: "cx11" + server_type: "cx22" - name: set instance variables run: | echo "SERVER_ADDRESS=${{ steps.create-test-instance.outputs.server_address }}" >> "$GITHUB_ENV" @@ -314,7 +314,7 @@ jobs: version: "${{ env.PREVIOUS_VERSION }}" uid: "${{ env.UID }}" hcloud_token: ${{ secrets.TEST_AUTOMATION_HCLOUD_API_TOKEN }} - server_type: "cx11" + server_type: "cx22" - name: Set instance variables run: | echo "SERVER_ADDRESS=${{ steps.create-test-instance.outputs.server_address }}" >> "$GITHUB_ENV" @@ -341,7 +341,7 @@ jobs: echo "Run integration tests" ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null" "root@${SERVER_ADDRESS}" cat /usr/local/etc/instance.cfg - test-ncp-instance -a -f "$SNAPSHOT_ID" -b "${VERSION}" --systemtest-args "--skip-update-test" --nc-test-args "--skip-release-check" "root@${SERVER_ADDRESS}" "localhost" "8443" "9443" || { + test-ncp-instance -a -f "$SNAPSHOT_ID" -b "v1.54.3" --systemtest-args "--skip-update-test" --nc-test-args "--skip-release-check" "root@${SERVER_ADDRESS}" "localhost" "8443" "9443" || { echo "Integration tests failed" echo "Here are the last lines of ncp-install.log:" @@ -387,7 +387,7 @@ jobs: NC_TEST_ARGS=() ssh "${SSH_OPTIONS[@]}" "root@${SERVER_ADDRESS}" cat /etc/os-release | grep VERSION_ID=12 || NC_TEST_ARGS+=("--skip-release-check") set -x - test-ncp-instance -f "$SNAPSHOT_ID" -b "${VERSION}" --nc-test-args "$NC_TEST_ARGS" --systemtest-args "--skip-update-test" "root@${SERVER_ADDRESS}" "localhost" "8443" "9443" || { + test-ncp-instance -f "$SNAPSHOT_ID" -b "v1.54.3" --nc-test-args "$NC_TEST_ARGS" --systemtest-args "--skip-update-test" "root@${SERVER_ADDRESS}" "localhost" "8443" "9443" || { echo "Integration tests failed" echo "Here are the last lines of ncp-install.log:" @@ -420,6 +420,45 @@ jobs: } ssh "${SSH_OPTIONS[@]}" "root@${SERVER_ADDRESS}" DEBIAN_FRONTEND=noninteractive ncp-dist-upgrade echo "skipped=no" | tee -a $GITHUB_OUTPUT + - name: Update Nextcloud + working-directory: /__w/nextcloudpi/nextcloudpi/ncp-test-automation/bin + run: | + set -ex + apk add jq + + echo "Setup ssh" + eval "$(ssh-agent)" + ssh-add /__w/nextcloudpi/nextcloudpi/.ssh/automation_ssh_key + + source ./library.sh + + current_nc_version="$(ssh "${SSH_OPTIONS[@]}" "root@${SERVER_ADDRESS}" "ncc status" | grep "version:" | awk '{ print $3 }')" + latest_nc_version="$(cat ../../etc/ncp.cfg | jq -r '.nextcloud_version')" + + if [[ "$current_nc_version" =~ "$latest_nc_version".* ]] + then + echo "Nextcloud is up to date - skipping NC update test." + else + for i in {1..10}; + do + echo "running nc update ($i/10)..." + ssh "${SSH_OPTIONS[@]}" "root@${SERVER_ADDRESS}" "bash -c 'DBG=x ncp-update-nc ${latest_nc_version?}'" + + ssh "${SSH_OPTIONS[@]}" "root@${SERVER_ADDRESS}" /usr/local/bin/ncc status + + current_nc_version_new="$(ssh "${SSH_OPTIONS[@]}" "root@${SERVER_ADDRESS}" "ncc status" | grep "version:" | awk '{ print $3 }')" + if [[ "$current_nc_version_new" =~ "$latest_nc_version".* ]] + then + break + fi + if [[ "$current_nc_version" == "$current_nc_version_new" ]] + then + echo "failed to update to $latest_nc_version" + exit 1 + fi + current_nc_version="$current_nc_version_new" + done + fi - name: Run integration tests after dist-upgrade id: final_test diff --git a/ncp-app/lib/Service/SettingsService.php b/ncp-app/lib/Service/SettingsService.php index 444c928b..daa78d46 100644 --- a/ncp-app/lib/Service/SettingsService.php +++ b/ncp-app/lib/Service/SettingsService.php @@ -139,7 +139,6 @@ class SettingsService { $stderr = stream_get_contents($pipes[2]); fclose($pipes[2]); - $this->logger->error("STDERR: $stderr"); return [proc_close($proc), $stdout, $stderr]; } }