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>
This commit is contained in:
thecalcaholic 2022-09-28 20:34:26 +02:00
parent fc79b722f2
commit a6aaa4abe8
No known key found for this signature in database
GPG Key ID: 3510056072886A8F
3 changed files with 124 additions and 1 deletions

View File

@ -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

View File

@ -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

View File

@ -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 \