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
18 changes: 17 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]
Usage: generate_ci_config.sh <output_path> <base_config_yaml> [--minio] [--jupyterhub] [--weko] [--flowable] [--s3compatsigv4] [--s3compatsigv4-inst] [--wiki]
USAGE
exit 1
fi
Expand All @@ -17,6 +17,7 @@ WEKO=false
FLOWABLE=false
S3COMPATSIGV4=false
S3COMPATSIGV4_INST=false
WIKI=false

for arg in "$@"; do
case "$arg" in
Expand All @@ -38,6 +39,9 @@ for arg in "$@"; do
--s3compatsigv4-inst)
S3COMPATSIGV4_INST=true
;;
--wiki)
WIKI=true
;;
*)
echo "Unknown argument: ${arg}" >&2
exit 1
Expand Down Expand Up @@ -195,4 +199,16 @@ s3compatsigv4_inst_bucket: '${S3COMPATSIGV4_INST_BUCKET}'
EOF
fi

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

wiki_enabled: true
EOF
else
cat >> "${OUTPUT}" <<'EOF'

wiki_enabled: false
EOF
fi

cat "${OUTPUT}"
7 changes: 6 additions & 1 deletion .github/scripts/setup_rdm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,18 @@ create_docker_override() {
local mfr_image="${MFR_IMAGE:-niicloudoperation/rdm-modular-file-renderer:latest}"
local wb_image="${WB_IMAGE:-niicloudoperation/rdm-waterbutler:latest}"
local elasticsearch_image="${ELASTICSEARCH_IMAGE:-elasticsearch:2}"

local y_websocket_url="${Y_WEBSOCKET_URL:-}"

echo "Creating docker-compose override with:"
echo " OSF: $osf_image"
echo " Ember: $ember_image"
echo " CAS: $cas_image"
echo " MFR: $mfr_image"
echo " WaterButler: $wb_image"
echo " Elasticsearch: $elasticsearch_image"
if [ -n "$y_websocket_url" ]; then
echo " Y-WebSocket: $y_websocket_url"
fi

cat > docker-compose.override.yml << EOL
# NII Cloud Operation images override
Expand Down Expand Up @@ -275,6 +279,7 @@ services:
environment:
OAUTHLIB_INSECURE_TRANSPORT: '1'
KAKEN_ELASTIC_URI: http://kaken_elasticsearch:9200
Y_WEBSOCKET_URL: '${y_websocket_url}'
worker:
image: ${osf_image}
environment:
Expand Down
45 changes: 45 additions & 0 deletions .github/scripts/setup_test_data.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import os
from django.utils import timezone
from osf.models import OSFUser, Node, Institution

WIKI_ENABLED = os.environ.get('WIKI_ENABLED', 'false').lower() == 'true'

INSTITUTION_NAME = 'Virginia Tech [Test]'

test_users = [
Expand Down Expand Up @@ -45,6 +48,39 @@
},
]

def create_rdmuserkey(user):
import datetime
import hashlib
from osf.models.rdm_user_key import RdmUserKey

PRIVATE_KEY_VALUE = 1
PUBLIC_KEY_VALUE = 2

if RdmUserKey.objects.filter(guid=user.id).exists():
print(f"RdmUserKey already exists for user: {user.username}")
return
now = datetime.datetime.now()
date_hash = hashlib.md5(now.strftime('%Y%m%d%H%M%S').encode('utf-8')).hexdigest()
pvt_key_name = f'{user._id}_{date_hash}_pvt.pem'
pub_key_name = f'{user._id}_{date_hash}_pub.pem'

pvt_key = RdmUserKey()
pvt_key.guid = user.id
pvt_key.key_name = pvt_key_name
pvt_key.key_kind = PRIVATE_KEY_VALUE
pvt_key.created_time = now
pvt_key.save()

pub_key = RdmUserKey()
pub_key.guid = user.id
pub_key.key_name = pub_key_name
pub_key.key_kind = PUBLIC_KEY_VALUE
pub_key.created_time = now
pub_key.save()

print(f"Created RdmUserKey (pvt+pub) for user: {user.username}")


for user_data in test_users:
username = user_data['username']
if not OSFUser.objects.filter(username=username).exists():
Expand Down Expand Up @@ -93,6 +129,10 @@
user.emails.create(address=username)
print(f"Created test user: {username}")

# Create user key (only needed when Wiki is enabled)
if WIKI_ENABLED:
create_rdmuserkey(user)

# Create a project for the new user
project = Node(
title=f"Test Project for {user_data['fullname']}",
Expand All @@ -109,6 +149,11 @@
print(f"Test user already exists: {username}")
# Ensure existing user has at least one project
user = OSFUser.objects.get(username=username)

# Create user key (only needed when Wiki is enabled)
if WIKI_ENABLED:
create_rdmuserkey(user)

if not user.nodes.filter(category='project').exists():
project = Node(
title=f"Test Project for {user.fullname}",
Expand Down
Loading
Loading