ADD ANUBIS_ASSIGNMENT_NAME to ide
@@ -9,7 +9,7 @@ from kubernetes import client, config
from anubis.github.parse import parse_github_repo_name
from anubis.lms.courses import get_course_admin_ids
from anubis.lms.theia import get_theia_pod_name, mark_session_ended
-from anubis.models import Course, TheiaSession, db, THEIA_DEFAULT_OPTIONS
+from anubis.models import Course, TheiaSession, Assignment, db, THEIA_DEFAULT_OPTIONS
from anubis.utils.auth.token import create_token
from anubis.utils.config import get_config_int, get_config_str
from anubis.utils.data import is_debug
@@ -66,6 +66,14 @@ def create_theia_k8s_pod_pvc(
else:
volume_size = get_config_str('THEIA_VOLUME_SIZE', '100Mi')
+ # Put assignment name in theia container environment
+ if theia_session.assignment_id is not None:
+ assignment: Assignment = theia_session.assignment
+ theia_extra_env.append(client.V1EnvVar(
+ name="ANUBIS_ASSIGNMENT_NAME",
+ value=assignment.name,
+ ))
+
# Value for if the git secret should be included in the init and sidecar
# containers (for provisioning and autosave).
include_git_secret: bool = True
