diff options
author | thecalcaholic <6317548+theCalcaholic@users.noreply.github.com> | 2022-09-28 21:34:26 +0300 |
---|---|---|
committer | thecalcaholic <6317548+theCalcaholic@users.noreply.github.com> | 2022-09-28 21:34:26 +0300 |
commit | a6aaa4abe8a2df9d8b3255eaae5ba16d1a616ccf (patch) | |
tree | 9de083c17a4bf726948c00f381feef49059ad2b7 | |
parent | fc79b722f227af156d86c670c7072119fb252fbd (diff) |
lamp.sh: Create systemd users manually, prevent changed uids
build-docker.yml: Add update tests
Signed-off-by: thecalcaholic <6317548+theCalcaholic@users.noreply.github.com>
-rw-r--r-- | .github/workflows/build-docker.yml | 116 | ||||
-rwxr-xr-x | build/docker/debian-ncp/run-parts.sh | 3 | ||||
-rw-r--r-- | lamp.sh | 6 |
3 files changed, 124 insertions, 1 deletions
diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 0a9b91a0..bae34c1d 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -61,6 +61,122 @@ jobs: docker push "thecalcaholic/ncp-internal-${{ matrix.arch }}:${{ github.run_id }}" docker push "thecalcaholic/ncp-internal-${{ matrix.arch }}:${{ github.run_id }}-testing" + update-from-latest: + needs: + - build + runs-on: ubuntu-latest + env: + VERSION: "${{ inputs.git_ref || github.ref }}" + + strategy: + matrix: + arch: + - armhf + - x86 + - arm64 + fail-fast: false + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Start ncp container + run: | + docker volume create ncdata + docker run --platform "linux/${{ matrix.arch }}" -v ncdata:/data -d --rm -p 8443:443 -p 4443:4443 --name nextcloudpi ownyourbits/nextcloudpi:latest + + - name: Checkout code + uses: actions/checkout@v3 + with: + ref: "${{ env.VERSION }}" + + - name: Setup Firefox + uses: browser-actions/setup-firefox@latest + - name: Setup GeckoDriver + uses: browser-actions/setup-geckodriver@latest + - name: Setup Selenium + run: pip install selenium + + - name: Activate container + working-directory: ./tests + run: | + docker logs nextcloudpi |& awk '{ print "CONTAINER::" $0 }' + echo 'CONTAINER:: ==========' + docker logs -f nextcloudpi |& awk '{ print "CONTAINER::" $0 }' & + docker exec nextcloudpi bash -c 'tail -f /var/log/ncp.log' |& awk '{ print "NCP::" $0 }' & + cmd=(python activation_tests.py --no-gui localhost 8443 4443) + [[ "${{ matrix.arch }}" == "x86" ]] || cmd+=(--timeout 300) + + success=false + for attempt in {1..3} + do + echo ":: Activation Tests (attempt $attempt/3) ::" + "${cmd[@]}" || { + tail -n 20 geckodriver.log >&2 || true + echo "CI:: Activation test (attempt $attempt/3) failed!" + docker exec nextcloudpi bash /usr/local/bin/ncp-diag + sleep 12 + continue + } + success=true + break + done + [[ "$success" == "true" ]] || { + echo "CI:: Activation test failed in all attempts!" + exit 1 + } + echo "CI:: Activation test successful" + - name: Start new container + run: | + docker stop nextcloudpi + docker run -d -v ncdata:/data --rm -p 8443:443 -p 4443:4443 --name nextcloudpi thecalcaholic/ncp-internal-${{ matrix.arch }}:${{ github.run_id }}-testing + - name: Integration Tests + working-directory: ./tests + run: | + docker logs nextcloudpi |& awk '{ print "CONTAINER::" $0 }' + echo 'CONTAINER:: ==========' + docker logs -f nextcloudpi |& awk '{ print "CONTAINER::" $0 }' & + docker exec nextcloudpi bash -c 'tail -f /var/log/ncp.log' |& awk '{ print "NCP::" $0 }' & + cmd=(python activation_tests.py --no-gui localhost 8443 4443) + [[ "${{ matrix.arch }}" == "x86" ]] || cmd+=(--timeout 300) + + success=false + for attempt in {1..3} + do + echo ":: System Tests (attempt $attempt/3) ::" + python system_tests.py --no-ping --non-interactive || { + echo "CI:: System test (attempt $attempt) failed!" + continue + } + success=true + break + done + [[ "$success" == "true" ]] || { + echo "CI:: System test failed in all attempts!" + exit 1 + } + echo "CI:: System test successful" + + success=false + for attempt in {1..3} + do + echo ":: Nextcloud Tests (attempt $attempt/3) ::" + python nextcloud_tests.py --no-gui localhost 8443 4443 || { + tail -n 20 geckodriver.log >&2 || true + echo "CI:: Nextcloud test (attempt $attempt/3) failed!" + continue + } + success=true + break + done + [[ "$success" == "true" ]] || { + echo "CI:: Nextcloud test failed in all attempts!" + exit 1 + } + echo "CI:: Nextcloud test successful" + + + + test: needs: - build diff --git a/build/docker/debian-ncp/run-parts.sh b/build/docker/debian-ncp/run-parts.sh index ee254449..15516e7e 100755 --- a/build/docker/debian-ncp/run-parts.sh +++ b/build/docker/debian-ncp/run-parts.sh @@ -37,7 +37,8 @@ cleanup() grep '/data-ro' /etc/mysql/mariadb.conf.d/90-ncp.cnf > /dev/null 2>&1 && { echo "WARNING: Looks like you have been affected by a critical bug in NCP that can cause data loss. We're trying" \ "to fix this now, but if you encounter any issues, please check" \ - "https://github.com/nextcloud/nextcloudpi/issues/1577#issuecomment-1260830341" + "https://github.com/nextcloud/nextcloudpi/issues/1577#issuecomment-1260830341" \ + "It is likely that you will have to restore a backup" chown -R mysql: /data/database || true } sed -i 's|/data-ro|/data|' "/etc/mysql/mariadb.conf.d/90-ncp.cnf" || true @@ -36,6 +36,12 @@ install() mkdir -p /run/lock apache2ctl -V || true + # Create systemd users to keep uids persistent between containers + addgroup --quiet --system systemd-journal + adduser --quiet -u 180 --system --group --no-create-home --home /run/systemd \ + --gecos "systemd Network Management" systemd-network + adduser --quiet -u 181 --system --group --no-create-home --home /run/systemd \ + --gecos "systemd Resolver" systemd-resolve install_with_shadow_workaround --no-install-recommends systemd $APTINSTALL -t $RELEASE php${PHPVER} php${PHPVER}-curl php${PHPVER}-gd php${PHPVER}-fpm php${PHPVER}-cli php${PHPVER}-opcache \ php${PHPVER}-mbstring php${PHPVER}-xml php${PHPVER}-zip php${PHPVER}-fileinfo php${PHPVER}-ldap \ |