Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stop copying unneccesary files into user home directory #2578

Merged
merged 8 commits into from
Jul 24, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,16 @@ def base_profile_home_mounts(username):
}

MKDIR_OWN_DIRECTORY = (
"mkdir -p /mnt/{path} && chmod 777 /mnt/{path} && cp -r /etc/skel/. /mnt/{path}"
"mkdir -p /mnt/{path} && chmod 777 /mnt/{path} && "
# Copy skel files/folders not starting with '..' to user home directory.
# Filtering out ..* removes some unneeded folders (k8s configmap mount implementation details).
"find /etc/skel/. -maxdepth 1 -not -name '.' -not -name '..*' -exec "
"cp -rL {escaped_brackets} /mnt/{path} \;"
)
command = MKDIR_OWN_DIRECTORY.format(
path=pvc_home_mount_path.format(username=username)
# have to escape the brackets since this string will be formatted later by KubeSpawner
escaped_brackets="{{}}",
path=pvc_home_mount_path.format(username=username),
)
init_containers = [
{
Expand Down
3 changes: 3 additions & 0 deletions tests/tests_deployment/test_jupyterhub_ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ def test_contains_jupyterhub_ssh(paramiko_object):
("cat ~/.bashrc", "Managed by Nebari"),
("cat ~/.profile", "Managed by Nebari"),
("cat ~/.bash_logout", "Managed by Nebari"),
# ensure we don't copy over extra files from /etc/skel in init container
("ls -la ~/..202*", "No such file or directory"),
("ls -la ~/..data", "No such file or directory"),
]

for command, output in commands_contain:
Expand Down
Loading