From 11311b6ead3d48ab6cade1832cd81016b81c8b93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rok=20Ro=C5=A1kar?= Date: Fri, 25 Oct 2024 13:50:27 +0200 Subject: [PATCH] chore: add jupyter-server-proxy (#15) --- .github/workflows/test.yaml | 2 +- src/renku/devcontainer-feature.json | 6 ++++-- src/renku/install.sh | 7 +++---- test/renku/renku-ubuntu-randomUser.sh | 21 ------------------- ...renku-ubuntu-jovyan.sh => renku-ubuntu.sh} | 3 --- test/renku/scenarios.json | 16 +++++--------- 6 files changed, 13 insertions(+), 42 deletions(-) delete mode 100644 test/renku/renku-ubuntu-randomUser.sh rename test/renku/{renku-ubuntu-jovyan.sh => renku-ubuntu.sh} (87%) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b89d90b..e4856bd 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -15,7 +15,7 @@ jobs: features: - renku baseImage: - - python:3.10 + - python:3.10.15 - mcr.microsoft.com/devcontainers/python:3.10 - ubuntu:focal - mcr.microsoft.com/devcontainers/base:ubuntu diff --git a/src/renku/devcontainer-feature.json b/src/renku/devcontainer-feature.json index 9f57784..f964db0 100644 --- a/src/renku/devcontainer-feature.json +++ b/src/renku/devcontainer-feature.json @@ -29,8 +29,10 @@ "ghcr.io/rocker-org/devcontainer-features/apt-packages:1": { "packages": "build-essential,bzip2,ca-certificates,curl,gpg-agent,gnupg,libglib2.0-0,libsm6,libxext6,libxrender1,rclone,tini,wget,vim,jq" }, - "ghcr.io/devcontainers/features/python:1": { │ - "version": "3.10" │ + "ghcr.io/devcontainers/features/python:1.3": { + "version": "3.10.15", + "installTools": true, + "toolsToInstall": "pipx" }, "ghcr.io/rocker-org/devcontainer-features/miniforge:1": {}, "ghcr.io/devcontainers/features/git:1": {}, diff --git a/src/renku/install.sh b/src/renku/install.sh index b2beee2..565a3e9 100644 --- a/src/renku/install.sh +++ b/src/renku/install.sh @@ -13,17 +13,16 @@ fi echo "The requested version is: $VERSION" # create the user if missing -if ! id -u "${USERNAME}" >/dev/null 2>&1 && [ "$CREATEUSER" = "true" ]; then +if ! id -u "${USERNAME}" >/dev/null 2>&1 && [ "$CREATEUSER" = "true" ] && ! getent passwd 1000 ; then useradd -l -m -s /bin/bash -N -u 1000 "${USERNAME}" fi # install jupyter if [ "${INSTALLJUPYTER}" = "true" ]; then - /opt/conda/bin/mamba install -y jupyterlab + /opt/conda/bin/mamba install -y jupyterlab jupyter-server-proxy ln -sf /opt/conda/bin/jupyter-server /opt/conda/bin/jupyter-notebook fi -pip install pipx -pipx install renku==${VERSION} +/usr/local/py-utils/bin/pipx install renku==${VERSION} chown -R ${USERNAME} /usr/local/py-utils diff --git a/test/renku/renku-ubuntu-randomUser.sh b/test/renku/renku-ubuntu-randomUser.sh deleted file mode 100644 index 1fb57b5..0000000 --- a/test/renku/renku-ubuntu-randomUser.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -set -e - -# Optional: Import test library bundled with the devcontainer CLI -source dev-container-features-test-lib - -# Feature-specific tests -# The 'check' command comes from the dev-container-features-test-lib. -check "renku is available" bash -c "renku --help" -check "git-lfs is available" bash -c "git lfs --help" -check "conda is available" bash -c "conda --version" -check "/opt/conda/bin is on PATH" bash -c "grep -q '/opt/conda/bin' <<< '$PATH'" -check "jupyter notebook works" bash -c "jupyter notebook --help" - -# check that the user is indeed jovyan -check "user is randomUser" bash -c "whoami | grep randomUser" - -# Report results -# If any of the checks above exited with a non-zero exit code, the test will fail. -reportResults diff --git a/test/renku/renku-ubuntu-jovyan.sh b/test/renku/renku-ubuntu.sh similarity index 87% rename from test/renku/renku-ubuntu-jovyan.sh rename to test/renku/renku-ubuntu.sh index 026f5ec..eb42f28 100644 --- a/test/renku/renku-ubuntu-jovyan.sh +++ b/test/renku/renku-ubuntu.sh @@ -13,9 +13,6 @@ check "conda is available" bash -c "conda --version" check "/opt/conda/bin is on PATH" bash -c "grep -q '/opt/conda/bin' <<< '$PATH'" check "jupyter notebook works" bash -c "jupyter notebook --help" -# check that the user is indeed jovyan -check "user is jovyan" bash -c "whoami | grep jovyan" - # Report results # If any of the checks above exited with a non-zero exit code, the test will fail. reportResults diff --git a/test/renku/scenarios.json b/test/renku/scenarios.json index 522bd1c..a10b8cb 100644 --- a/test/renku/scenarios.json +++ b/test/renku/scenarios.json @@ -2,22 +2,16 @@ "renku-base-notebook": { "image": "jupyter/base-notebook:python-3.10", "features": { - "renku": {} - }, - "remoteUser": "jovyan" - }, - "renku-ubuntu-jovyan": { - "image": "ubuntu", - "features": { - "renku": {} + "renku": { + "createUser": false + } }, "remoteUser": "jovyan" }, - "renku-ubuntu-randomUser": { + "renku-ubuntu": { "image": "ubuntu", "features": { "renku": {} - }, - "remoteUser": "randomUser" + } } }