Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion .github/scripts/generate_ci_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -xeuo pipefail

if [[ $# -lt 2 ]]; then
cat >&2 <<'USAGE'
Usage: generate_ci_config.sh <output_path> <base_config_yaml> [--minio] [--jupyterhub] [--weko] [--flowable] [--s3compatsigv4] [--s3compatsigv4-inst] [--wiki]
Usage: generate_ci_config.sh <output_path> <base_config_yaml> [--minio] [--nextcloud] [--jupyterhub] [--weko] [--flowable] [--s3compatsigv4] [--s3compatsigv4-inst] [--wiki]
USAGE
exit 1
fi
Expand All @@ -12,6 +12,7 @@ OUTPUT=$1
BASE_CONFIG=$2
shift 2
MINIO=false
NEXTCLOUD=false
JUPYTERHUB=false
WEKO=false
FLOWABLE=false
Expand All @@ -24,6 +25,9 @@ for arg in "$@"; do
--minio)
MINIO=true
;;
--nextcloud)
NEXTCLOUD=true
;;
--jupyterhub)
JUPYTERHUB=true
;;
Expand Down Expand Up @@ -85,6 +89,16 @@ storages_s3: []
EOF
fi

if [[ "${NEXTCLOUD}" == "true" ]]; then
cat >> "${OUTPUT}" <<EOF

nextcloud_enabled: true
nextcloud_url: '${NEXTCLOUD_URL}'
nextcloud_username: '${NEXTCLOUD_USERNAME}'
nextcloud_password: '${NEXTCLOUD_PASSWORD}'
EOF
fi

if [[ "${JUPYTERHUB}" == "true" ]]; then
if [[ -z "${TLJH_URL:-}" || -z "${TLJH_USERNAME:-}" || -z "${TLJH_PASSWORD:-}" ]]; then
echo "TLJH connection information is not set" >&2
Expand Down
69 changes: 69 additions & 0 deletions .github/scripts/setup_nextcloud.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash
set -xeuo pipefail

SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
FIXTURE_DIR=$(cd "${SCRIPT_DIR}/../../docker/nextcloud" && pwd)
COMMAND=${1:?Usage: setup_nextcloud.sh <prepare|install|down> [RDM directory]}

case "$COMMAND" in
prepare)
RDM_DIR=${2:?RDM directory is required}
mkdir -p "${FIXTURE_DIR}/.state"
openssl req -x509 -newkey rsa:2048 -nodes -days 3 \
-keyout "${FIXTURE_DIR}/.state/server.key" \
-out "${FIXTURE_DIR}/.state/server.crt" \
-subj '/CN=192.168.168.167' \
-addext 'subjectAltName=IP:192.168.168.167' \
-addext 'basicConstraints=critical,CA:TRUE'
cat > "${RDM_DIR}/addons/nextcloud/settings/local.py" <<SETTINGS
DEFAULT_HOSTS = ['${NEXTCLOUD_URL}']
USE_SSL = True
SETTINGS
;;
install)
RDM_DIR=${2:?RDM directory is required}
docker compose -f "${FIXTURE_DIR}/compose.yaml" up -d
for ((attempt=1; attempt<=30; attempt++)); do
if curl --fail --cacert "${FIXTURE_DIR}/.state/server.crt" \
"${NEXTCLOUD_URL}/status.php" -o "${FIXTURE_DIR}/.state/status.json" \
&& python3 -c 'import json,sys; sys.exit(not json.load(open(sys.argv[1]))["installed"])' \
"${FIXTURE_DIR}/.state/status.json"; then
break
fi
if [[ "$attempt" == 30 ]]; then
echo 'Nextcloud installation timed out' >&2
exit 1
fi
sleep 10
done
curl --fail --cacert "${FIXTURE_DIR}/.state/server.crt" \
--user "${NEXTCLOUD_USERNAME}:${NEXTCLOUD_PASSWORD}" -X MKCOL \
"${NEXTCLOUD_URL}/remote.php/dav/files/${NEXTCLOUD_USERNAME}/e2e"
cd "$RDM_DIR"
for service in web api worker wb wb_worker; do
container=$(docker-compose ps -q "$service")
docker cp "${FIXTURE_DIR}/.state/server.crt" "${container}:/tmp/nextcloud-ca.crt"
docker-compose exec -T "$service" python3 - <<'PY'
import ssl
from pathlib import Path
import certifi

certificate = Path('/tmp/nextcloud-ca.crt').read_bytes()
bundle = Path(certifi.where())
if certificate not in bundle.read_bytes():
with bundle.open('ab') as stream:
stream.write(b'\n' + certificate)
openssl_bundle = Path(ssl.get_default_verify_paths().openssl_cafile)
openssl_bundle.write_bytes(bundle.read_bytes())
PY
done
docker-compose restart web api worker wb wb_worker
;;
down)
docker compose -f "${FIXTURE_DIR}/compose.yaml" down -v
;;
*)
echo "Unknown command: $COMMAND" >&2
exit 1
;;
esac
56 changes: 56 additions & 0 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,24 @@ jobs:
flowable_enabled: false
wiki_enabled: false
mapcore_group_enabled: false
- name: user-nextcloud
display_name: "User Tests (Nextcloud)"
include_admin: false
skip_admin: true
skip_metadata: true
skip_autofill: true
skip_default_storage: true
skip_login: true
skip_130mb_upload: true
minio_enabled: false
s3compatsigv4_enabled: false
weko_enabled: false
mibyo_db_enabled: false
jupyterhub_enabled: false
flowable_enabled: false
wiki_enabled: false
mapcore_group_enabled: false
nextcloud_enabled: true
- name: admin-minio
display_name: "Admin Tests (MinIO)"
include_admin: true
Expand Down Expand Up @@ -475,6 +493,10 @@ jobs:
mapcore_group_enabled: true
name: E2E ${{ matrix.test-group.display_name }}
env:
NEXTCLOUD_ENABLED: ${{ matrix.test-group.nextcloud_enabled == true && 'true' || 'false' }}
NEXTCLOUD_URL: https://192.168.168.167:18443
NEXTCLOUD_USERNAME: e2eadmin
NEXTCLOUD_PASSWORD: e2epassword123
MINIO_ENABLED: ${{ matrix.test-group.minio_enabled == true && 'true' || 'false' }}
S3COMPATSIGV4_ENABLED: ${{ matrix.test-group.s3compatsigv4_enabled == true && 'true' || 'false' }}
S3COMPATSIGV4_INST_ENABLED: ${{ matrix.test-group.s3compatsigv4_institutional_storage == true && 'true' || 'false' }}
Expand Down Expand Up @@ -888,6 +910,11 @@ jobs:
export INCLUDE_ADMIN=${{ matrix.test-group.include_admin }}
setup_config_files

- name: Prepare Nextcloud configuration
if: env.NEXTCLOUD_ENABLED == 'true'
working-directory: e2e-tests
run: .github/scripts/setup_nextcloud.sh prepare ../RDM-osf.io

- name: Parse PR body and workflow parameters
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
Expand Down Expand Up @@ -1103,6 +1130,15 @@ jobs:
export INCLUDE_ADMIN=${{ matrix.test-group.include_admin }}
start_rdm_services

- name: Start Nextcloud and trust its certificate
if: env.NEXTCLOUD_ENABLED == 'true'
working-directory: e2e-tests
run: |
.github/scripts/setup_nextcloud.sh install ../RDM-osf.io
cd ../RDM-osf.io
source ../e2e-tests/.github/scripts/setup_rdm.sh
test_rdm_endpoints

- name: Register OAuth scopes
working-directory: RDM-osf.io
run: |
Expand Down Expand Up @@ -1484,6 +1520,9 @@ jobs:
if [ "${MINIO_ENABLED}" = "true" ]; then
args+=(--minio)
fi
if [ "${NEXTCLOUD_ENABLED}" = "true" ]; then
args+=(--nextcloud)
fi
if [ "${JUPYTERHUB_ENABLED}" = "true" ]; then
args+=(--jupyterhub)
fi
Expand Down Expand Up @@ -1682,6 +1721,23 @@ jobs:
path: e2e-tests/y-websocket-logs.txt
if-no-files-found: ignore

- name: Collect Nextcloud logs
if: always() && env.NEXTCLOUD_ENABLED == 'true'
working-directory: e2e-tests
run: docker compose -f docker/nextcloud/compose.yaml logs > nextcloud-logs.txt 2>&1

- name: Upload Nextcloud logs
if: always() && env.NEXTCLOUD_ENABLED == 'true'
uses: actions/upload-artifact@v4
with:
name: nextcloud-logs-${{ matrix.test-group.name }}
path: e2e-tests/nextcloud-logs.txt

- name: Stop Nextcloud stack
if: always() && env.NEXTCLOUD_ENABLED == 'true'
working-directory: e2e-tests
run: .github/scripts/setup_nextcloud.sh down

- name: Stop WEKO stack
if: always() && (env.WEKO_ENABLED == 'true' || env.MIBYO_DB_ENABLED == 'true')
working-directory: e2e-tests
Expand Down
1 change: 1 addition & 0 deletions docker/nextcloud/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.state/
23 changes: 23 additions & 0 deletions docker/nextcloud/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
services:
nextcloud:
image: nextcloud:35.0.2-apache
entrypoint: ["/bin/bash", "-ec"]
command:
- |
a2enmod ssl
a2ensite default-ssl
exec /entrypoint.sh apache2-foreground
ports:
- '18443:443'
environment:
NEXTCLOUD_ADMIN_USER: ${NEXTCLOUD_USERNAME:?}
NEXTCLOUD_ADMIN_PASSWORD: ${NEXTCLOUD_PASSWORD:?}
SQLITE_DATABASE: nextcloud
NEXTCLOUD_TRUSTED_DOMAINS: 192.168.168.167
OVERWRITEPROTOCOL: https
volumes:
- nextcloud_data:/var/www/html
- ./.state/server.crt:/etc/ssl/certs/ssl-cert-snakeoil.pem:ro
- ./.state/server.key:/etc/ssl/private/ssl-cert-snakeoil.key:ro
volumes:
nextcloud_data:
17 changes: 17 additions & 0 deletions run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def __init__(self, config_path, show_disk_usage=False, failed_result_path=None):
self.skip_login = False
self.enable_1gb_file_upload = False
self.skip_autofill = False
self.nextcloud_enabled = False
self.jupyterhub_enabled = False
self.tljh_url = None
self.tljh_username = None
Expand Down Expand Up @@ -315,6 +316,22 @@ def run_storage_tests(self):
)
)

if self.nextcloud_enabled:
self.result_notebooks.append(
self.run_notebook(
'テスト手順-WebDAVストレージ-アカウント設定.ipynb',
webdav_host=self.nextcloud_url,
webdav_username=self.nextcloud_username,
webdav_password=self.nextcloud_password,
webdav_folder='e2e',
rdm_project_name='TEST-NEXTCLOUD-{}'.format(
datetime.now().strftime('%Y%m%d-%H%M%S')
),
skip_130mb_upload=self.skip_130mb_upload,
skip_preview_check=self.skip_preview_check,
)
)

# OAuth storage tests (require manual setup, so skip in automated tests)
print('\nSkipping OAuth storage tests (require manual setup)')

Expand Down
Loading
Loading