|
| 1 | +name: 'install-smoke-test' |
| 2 | + |
| 3 | +# Manual / scheduled smoke test that runs nextcloud_install_production.sh |
| 4 | +# end-to-end inside a privileged Ubuntu 26.04 container. Catches: |
| 5 | +# - apt package availability changes between LTS releases |
| 6 | +# - PHP/PG/Apache config breakage |
| 7 | +# - Nextcloud download + occ install regressions |
| 8 | +# - lib.sh sourcing / version-gate regressions |
| 9 | +# |
| 10 | +# Does NOT cover: |
| 11 | +# - real LVM snapshot / lvextend behavior (loopback approximation) |
| 12 | +# - hypervisor-specific kernel installs (Hyper-V, VMware, QEMU) |
| 13 | +# - reboot path (stubbed) |
| 14 | +# |
| 15 | +# Manual trigger only — runtime ~25 min, ~3 GB RAM. |
| 16 | + |
| 17 | +on: |
| 18 | + pull_request: |
| 19 | + workflow_dispatch: |
| 20 | + inputs: |
| 21 | + ubuntu_image: |
| 22 | + description: 'Ubuntu image to test against (e.g. ubuntu:26.04, ubuntu:24.04)' |
| 23 | + default: 'ubuntu:26.04' |
| 24 | + required: true |
| 25 | + |
| 26 | +permissions: |
| 27 | + contents: read |
| 28 | + |
| 29 | +jobs: |
| 30 | + install: |
| 31 | + name: 'Run nextcloud_install_production.sh -p' |
| 32 | + runs-on: ubuntu-latest |
| 33 | + timeout-minutes: 45 |
| 34 | + steps: |
| 35 | + - name: Checkout |
| 36 | + uses: actions/checkout@v6 |
| 37 | + with: |
| 38 | + # Default checks out the ref that fired workflow_dispatch (so picking |
| 39 | + # `upgrade-os-26.04` from the UI tests that branch). |
| 40 | + ref: ${{ github.ref }} |
| 41 | + |
| 42 | + - name: Run install script in privileged container |
| 43 | + env: |
| 44 | + UBUNTU_IMAGE: ${{ inputs.ubuntu_image || 'ubuntu:26.04' }} |
| 45 | + run: | |
| 46 | + set -e |
| 47 | + docker run --rm \ |
| 48 | + --privileged \ |
| 49 | + --user 0:0 \ |
| 50 | + --name nc-install \ |
| 51 | + -v "$PWD:/repo:ro" \ |
| 52 | + -e DEBIAN_FRONTEND=noninteractive \ |
| 53 | + -e SUDO_USER=root \ |
| 54 | + -e RUNLEVEL=1 \ |
| 55 | + -e TERM=dumb \ |
| 56 | + -e LANG=C.UTF-8 \ |
| 57 | + -e LC_ALL=C.UTF-8 \ |
| 58 | + "$UBUNTU_IMAGE" \ |
| 59 | + bash -c ' |
| 60 | + set -e |
| 61 | + # Diagnostics — confirm we are root inside the container |
| 62 | + id |
| 63 | + # Bare image bootstrap so the install script can run |
| 64 | + apt-get update -qq |
| 65 | + apt-get install -qqy --no-install-recommends \ |
| 66 | + sudo curl ca-certificates lsb-release iproute2 \ |
| 67 | + netcat-openbsd whiptail locales mount util-linux |
| 68 | + # Generate the C.UTF-8 locale so ram_check can parse meminfo |
| 69 | + locale-gen C.UTF-8 en_US.UTF-8 |
| 70 | + update-locale LANG=C.UTF-8 LC_ALL=C.UTF-8 |
| 71 | + # Override the default policy-rc.d that blocks service starts in |
| 72 | + # apt postinst. Without this, postgresql installs but its cluster |
| 73 | + # never gets started → install script'"'"'s psql calls fail. |
| 74 | + # The install script does NOT want a pre-installed postgres |
| 75 | + # (stop_if_installed postgresql), so we just allow it to install |
| 76 | + # cleanly and start itself. |
| 77 | + printf "#!/bin/sh\nexit 0\n" > /usr/sbin/policy-rc.d |
| 78 | + chmod 0755 /usr/sbin/policy-rc.d |
| 79 | + # Pre-seed /var/scripts so fetch_lib.sh uses THIS branch'"'"'s lib.sh |
| 80 | + # instead of downloading the stale copy from main. |
| 81 | + # fetch_lib.sh skips the download when both files already exist. |
| 82 | + mkdir -p /var/scripts |
| 83 | + cp /repo/lib.sh /var/scripts/lib.sh |
| 84 | + touch /var/scripts/nextcloud-startup-script.sh |
| 85 | + # Loop device for /dev/sdb (script expects a second disk for ZFS). |
| 86 | + # Best-effort: skip silently if losetup unavailable in this kernel. |
| 87 | + # `loop` is built into the host kernel on GH runners, no modprobe needed. |
| 88 | + set +e |
| 89 | + truncate -s 6G /tmp/disk-sdb.img |
| 90 | + LOOP=$(losetup -f 2>/dev/null) |
| 91 | + if [ -n "$LOOP" ] && losetup -P "$LOOP" /tmp/disk-sdb.img 2>/dev/null; then |
| 92 | + ln -sf "$LOOP" /dev/sdb |
| 93 | + echo "Created /dev/sdb -> $LOOP" |
| 94 | + else |
| 95 | + echo "WARNING: could not create loop device; format-sdb step will fail" >&2 |
| 96 | + fi |
| 97 | + set -e |
| 98 | + # Stub reboot so the script does not actually try to reboot. |
| 99 | + # (printf instead of heredoc — closing heredoc tag cannot be indented |
| 100 | + # inside a YAML run block.) |
| 101 | + printf "#!/bin/sh\necho \"[reboot stubbed in CI: \$*]\" >&2\nexit 0\n" \ |
| 102 | + > /usr/local/sbin/reboot |
| 103 | + chmod +x /usr/local/sbin/reboot |
| 104 | + ln -sf /usr/local/sbin/reboot /usr/local/sbin/shutdown |
| 105 | + # Make a copy we can edit (script lives in read-only mount) |
| 106 | + cp -a /repo /work |
| 107 | + cd /work |
| 108 | + # Run installer in provisioning mode (no prompts) |
| 109 | + bash nextcloud_install_production.sh -p |
| 110 | + ' |
0 commit comments