Skip to content

Commit bd5e2dd

Browse files
committed
Merge branch 'DECO-2040-upgrade-nextcloud-33' of github.com:GDATASoftwareAG/nextcloud-gdata-antivirus into DECO-2040-upgrade-nextcloud-33
2 parents 411030f + fed3c35 commit bd5e2dd

12 files changed

Lines changed: 71 additions & 50 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: 2026 G DATA CyberDefense AG
1+
# SPDX-FileCopyrightText: 2026 G DATA CyberDefense AG <vaas@gdata.de>
22
# SPDX-License-Identifier: AGPL-3.0-or-later
33

44
FROM mcr.microsoft.com/devcontainers/base:trixie
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
SPDX-FileCopyrightText: 2026 G DATA CyberDefense AG
1+
SPDX-FileCopyrightText: 2026 G DATA CyberDefense AG <vaas@gdata.de>
22

33
SPDX-License-Identifier: AGPL-3.0-or-later

.github/workflows/tests.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ jobs:
6060
sed -i "s/<version>0.0.0<\/version>/<version>$RELEASE_VERSION<\/version>/g" ./appinfo/info.xml
6161
6262
- name: unittests
63-
env:
64-
CLIENT_ID: ${{ secrets.VAAS_CLIENT_ID }}
65-
CLIENT_SECRET: ${{ secrets.VAAS_CLIENT_SECRET }}
6663
run: |
6764
composer install
6865
./vendor/bin/phpunit --bootstrap tests/unittests/bootstrap.php tests/unittests/ --testdox
@@ -76,7 +73,9 @@ jobs:
7673
env:
7774
CLIENT_ID: ${{ secrets.VAAS_CLIENT_ID }}
7875
CLIENT_SECRET: ${{ secrets.VAAS_CLIENT_SECRET }}
79-
run: ./scripts/run-app.sh 31.0.8 1
76+
run: |
77+
source nextcloud.env
78+
./scripts/run-app.sh "$NEXTCLOUD_VERSION" 1
8079
8180
- name: add builder into nextcloud network
8281
run: |
@@ -91,7 +90,10 @@ jobs:
9190
curl --fail --show-error --silent --connect-timeout 5 --max-time 10 "http://${NEXTCLOUD_HOSTNAME}/status.php" > /dev/null
9291
curl --fail --show-error --silent --connect-timeout 5 --max-time 10 "http://nextcloud-container/status.php" > /dev/null
9392
bats --verbose-run --timing --trace ./tests/bats
93+
# Need to dump env into .env because phpunit does not pass them on to tests
94+
printenv | sed "s/'/'\"'\"'/g; s/=/='/; s/$/'/" > .env
9495
./vendor/bin/phpunit --bootstrap tests/integration/bootstrap.php tests/integration/
96+
rm -f .env
9597
9698
- uses: actions/upload-artifact@master
9799
with:

Makefile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ appstore_package_name=$(appstore_build_directory)/$(app_real_name)
1111
npm=$(shell which npm 2> /dev/null)
1212
composer=$(shell which composer 2> /dev/null)
1313

14+
include nextcloud.env
15+
1416
all: build
1517

1618
# Fetches dependencies and builds it
@@ -30,7 +32,7 @@ endif
3032
.PHONY: oc
3133
oc:
3234
ifeq (,$(wildcard nextcloud-server))
33-
./scripts/get-nc-server.sh
35+
./scripts/get-nc-server.sh "$(NEXTCLOUD_VERSION)"
3436
endif
3537

3638
# Installs and updates the composer dependencies. If composer is not installed
@@ -80,20 +82,20 @@ unittests:
8082
# Run integration tests
8183
.PHONY: integrationtests
8284
integrationtests:
83-
./scripts/run-app.sh "33.0.0" 1
85+
./scripts/run-app.sh "$(NEXTCLOUD_VERSION)" 1
8486
composer install
8587
./vendor/bin/phpunit -c tests/integration/phpunit.xml tests/integration/ --testdox
8688

8789
# Run bats tests
8890
.PHONY: bats
8991
bats:
90-
./scripts/run-app.sh "33.0.0" 1
92+
./scripts/run-app.sh "$(NEXTCLOUD_VERSION)" 1
9193
bats --verbose-run --timing --trace ./tests/bats
9294

9395
# Complete production like but static Nextcloud and app setup
9496
.PHONY: prod
9597
prod: oc
96-
./scripts/run-app.sh "33.0.0" 1
98+
./scripts/run-app.sh "$(NEXTCLOUD_VERSION)" 1
9799

98100
# Same as clean but also removes dependencies and build related folders
99101
.PHONY: distclean
@@ -111,7 +113,7 @@ local: build
111113
docker compose kill || true
112114
docker stop nextcloud-container || true
113115
docker container rm nextcloud-container || true
114-
docker run --rm -d -p 8080:80 --name nextcloud-container -e SERVER_BRANCH="v33.0.0" -v .:/var/www/html/apps-extra/gdatavaas ghcr.io/juliusknorr/nextcloud-dev-php84:latest
116+
docker run --rm -d -p 8080:80 --name nextcloud-container -e SERVER_BRANCH="v$(NEXTCLOUD_VERSION)" -v .:/var/www/html/apps-extra/gdatavaas ghcr.io/juliusknorr/nextcloud-dev-php84:latest
115117
composer install
116118

117119
# Builds the app for production and prepares it for the appstore under ./build/artifacts

docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
services:
66
nextcloud-container:
7-
image: nextcloud:33.0.0
7+
image: nextcloud:${NEXTCLOUD_VERSION:?NEXTCLOUD_VERSION must be set}
88
ports:
99
- "8080:80"
1010
container_name: nextcloud-container

nextcloud.env

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# SPDX-FileCopyrightText: 2026 G DATA CyberDefense AG <vaas@gdata.de>
2+
#
3+
# SPDX-License-Identifier: AGPL-3.0-or-later
4+
5+
# Shared Nextcloud version for Makefile, scripts, compose, and CI.
6+
NEXTCLOUD_VERSION=33.0.3

scripts/get-nc-server.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@
44
#
55
# SPDX-License-Identifier: AGPL-3.0-or-later
66

7+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8+
79
rm -rf nextcloud-server/
8-
export NEXTCLOUD_VERSION=${1:-33.0.0}
10+
if [ -z "${NEXTCLOUD_VERSION:-}" ]; then
11+
source "$SCRIPT_DIR/../nextcloud.env"
12+
fi
13+
14+
export NEXTCLOUD_VERSION=${1:-${NEXTCLOUD_VERSION}}
915
git clone --depth 1 --recurse-submodules --single-branch --branch v"$NEXTCLOUD_VERSION" https://github.com/nextcloud/server.git ./nextcloud-server
1016
cd nextcloud-server || exit 1
1117
git submodule update --init

scripts/run-app.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66

77
set -e
88

9-
export NEXTCLOUD_VERSION=${1:-33.0.0}
9+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
10+
if [ -z "${NEXTCLOUD_VERSION:-}" ]; then
11+
source "$SCRIPT_DIR/../nextcloud.env"
12+
fi
13+
14+
export NEXTCLOUD_VERSION=${1:-${NEXTCLOUD_VERSION}}
1015
export IS_CI=${2:-0}
1116

1217
if [ "$IS_CI" -eq 0 ]; then
@@ -24,7 +29,7 @@ setup_nextcloud () {
2429
docker container rm garaged || true
2530
docker compose -f docker-compose.yaml kill || true
2631
docker compose -f docker-compose.yaml down --volumes || true
27-
docker compose -f docker-compose.yaml up --build -d
32+
NEXTCLOUD_VERSION="$NEXTCLOUD_VERSION" docker compose -f docker-compose.yaml up --build -d
2833

2934
until docker exec --user www-data -i nextcloud-container php occ status | grep "installed: false"
3035
do

tests/bats/.env-test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77

88
if [[ "$IS_CI" == 1 ]]; then
9-
export HOSTNAME=nextcloud-container
9+
export NEXTCLOUD_HOSTNAME=nextcloud-container
1010
else
11-
export HOSTNAME=127.0.0.1:8080
11+
export NEXTCLOUD_HOSTNAME=127.0.0.1:8080
1212
fi
1313

1414
if [[ "$IS_CI" == 1 ]]; then

tests/bats/functionality-parallel.bats

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,47 +21,47 @@ setup_file() {
2121

2222
@test "test admin eicar Upload" {
2323
EICAR_LENGTH=$(echo $EICAR_STRING | wc -c)
24-
RESULT=$(echo $EICAR_STRING | curl -v -X PUT -w "%{http_code}" -u admin:admin -T - http://$HOSTNAME/remote.php/dav/files/admin/functionality-parallel.eicar.com.txt || echo "curl failed")
24+
RESULT=$(echo $EICAR_STRING | curl -v -X PUT -w "%{http_code}" -u admin:admin -T - http://$NEXTCLOUD_HOSTNAME/remote.php/dav/files/admin/functionality-parallel.eicar.com.txt || echo "curl failed")
2525

2626
echo "Actual: $RESULT"
27-
curl --silent -q -u admin:admin -X DELETE http://$HOSTNAME/remote.php/dav/files/admin/functionality-parallel.eicar.com.txt || echo "file not found"
27+
curl --silent -q -u admin:admin -X DELETE http://$NEXTCLOUD_HOSTNAME/remote.php/dav/files/admin/functionality-parallel.eicar.com.txt || echo "file not found"
2828
[[ "$RESULT" =~ "Virus found" ]]
2929
}
3030

3131
@test "test admin clean upload" {
32-
RESULT=$(echo $CLEAN_STRING | curl -w "%{http_code}" -u admin:admin -T - http://$HOSTNAME/remote.php/dav/files/admin/functionality-parallel.clean.txt || echo "curl failed")
32+
RESULT=$(echo $CLEAN_STRING | curl -w "%{http_code}" -u admin:admin -T - http://$NEXTCLOUD_HOSTNAME/remote.php/dav/files/admin/functionality-parallel.clean.txt || echo "curl failed")
3333

3434
echo "Actual: $RESULT"
35-
curl --silent -q -u admin:admin -X DELETE http://$HOSTNAME/remote.php/dav/files/admin/functionality-parallel.clean.txt || echo "file not found"
35+
curl --silent -q -u admin:admin -X DELETE http://$NEXTCLOUD_HOSTNAME/remote.php/dav/files/admin/functionality-parallel.clean.txt || echo "file not found"
3636
[[ $RESULT -ge 200 && $RESULT -lt 300 ]]
3737
}
3838

3939
@test "test admin pup Upload" {
40-
RESULT=$(curl --silent -w "%{http_code}" -u admin:admin -T $FOLDER_PREFIX/pup.exe http://$HOSTNAME/remote.php/dav/files/admin/functionality-parallel.pup.exe)
40+
RESULT=$(curl --silent -w "%{http_code}" -u admin:admin -T $FOLDER_PREFIX/pup.exe http://$NEXTCLOUD_HOSTNAME/remote.php/dav/files/admin/functionality-parallel.pup.exe)
4141
echo "Actual: $RESULT"
42-
curl --silent -q -u admin:admin -X DELETE http://$HOSTNAME/remote.php/dav/files/admin/functionality-parallel.pup.exe || echo "file not found"
42+
curl --silent -q -u admin:admin -X DELETE http://$NEXTCLOUD_HOSTNAME/remote.php/dav/files/admin/functionality-parallel.pup.exe || echo "file not found"
4343
[[ $RESULT -ge 200 && $RESULT -lt 300 ]]
4444
}
4545

4646
@test "test testuser eicar Upload" {
47-
RESULT=$(echo $EICAR_STRING | curl --silent -w "%{http_code}" -u $TESTUSER:$TESTUSER_PASSWORD -T - http://$HOSTNAME/remote.php/dav/files/$TESTUSER/functionality-parallel.eicar.com.txt)
47+
RESULT=$(echo $EICAR_STRING | curl --silent -w "%{http_code}" -u $TESTUSER:$TESTUSER_PASSWORD -T - http://$NEXTCLOUD_HOSTNAME/remote.php/dav/files/$TESTUSER/functionality-parallel.eicar.com.txt)
4848
echo "Actual: $RESULT"
4949
$DOCKER_EXEC_WITH_USER -i nextcloud-container php occ config:app:get gdatavaas clientSecret
50-
curl --silent -q -u $TESTUSER:$TESTUSER_PASSWORD -X DELETE http://$HOSTNAME/remote.php/dav/files/$TESTUSER/functionality-parallel.eicar.com.txt || echo "file not found"
50+
curl --silent -q -u $TESTUSER:$TESTUSER_PASSWORD -X DELETE http://$NEXTCLOUD_HOSTNAME/remote.php/dav/files/$TESTUSER/functionality-parallel.eicar.com.txt || echo "file not found"
5151
[[ "$RESULT" =~ "Virus found" ]]
5252
}
5353

5454
@test "test testuser clean Upload" {
55-
STATUS_CODE=$(echo $CLEAN_STRING | curl --silent -w "%{http_code}" -u $TESTUSER:$TESTUSER_PASSWORD -T - http://$HOSTNAME/remote.php/dav/files/$TESTUSER/functionality-parallel.clean.txt)
55+
STATUS_CODE=$(echo $CLEAN_STRING | curl --silent -w "%{http_code}" -u $TESTUSER:$TESTUSER_PASSWORD -T - http://$NEXTCLOUD_HOSTNAME/remote.php/dav/files/$TESTUSER/functionality-parallel.clean.txt)
5656
echo "Actual: $RESULT"
57-
curl --silent -q -u $TESTUSER:$TESTUSER_PASSWORD -X DELETE http://$HOSTNAME/remote.php/dav/files/$TESTUSER/functionality-parallel.clean.txt || echo "file not found"
57+
curl --silent -q -u $TESTUSER:$TESTUSER_PASSWORD -X DELETE http://$NEXTCLOUD_HOSTNAME/remote.php/dav/files/$TESTUSER/functionality-parallel.clean.txt || echo "file not found"
5858
[[ $STATUS_CODE -ge 200 && $STATUS_CODE -lt 300 ]] || exit 1
5959
}
6060

6161
@test "test testuser pup Upload" {
62-
RESULT=$(curl --silent -w "%{http_code}" -u $TESTUSER:$TESTUSER_PASSWORD -T $FOLDER_PREFIX/pup.exe http://$HOSTNAME/remote.php/dav/files/$TESTUSER/functionality-parallel.pup.exe)
62+
RESULT=$(curl --silent -w "%{http_code}" -u $TESTUSER:$TESTUSER_PASSWORD -T $FOLDER_PREFIX/pup.exe http://$NEXTCLOUD_HOSTNAME/remote.php/dav/files/$TESTUSER/functionality-parallel.pup.exe)
6363
echo "Actual: $RESULT"
64-
curl --silent -q -u $TESTUSER:$TESTUSER_PASSWORD -X DELETE http://$HOSTNAME/remote.php/dav/files/$TESTUSER/functionality-parallel.pup.exe || echo "file not found"
64+
curl --silent -q -u $TESTUSER:$TESTUSER_PASSWORD -X DELETE http://$NEXTCLOUD_HOSTNAME/remote.php/dav/files/$TESTUSER/functionality-parallel.pup.exe || echo "file not found"
6565
[[ $RESULT -ge 200 && $RESULT -lt 300 ]] || exit 1
6666
}
6767

0 commit comments

Comments
 (0)