diff --git a/.github/workflows/test-pr.yaml b/.github/workflows/test-pr.yaml index 79a34fb66..758ab2b74 100644 --- a/.github/workflows/test-pr.yaml +++ b/.github/workflows/test-pr.yaml @@ -57,6 +57,11 @@ jobs: "mcr.microsoft.com/devcontainers/base:debian", "mcr.microsoft.com/devcontainers/base:noble" ] + exclude: + - features: oryx + baseImage: ubuntu:jammy + - features: oryx + baseImage: mcr.microsoft.com/devcontainers/base:ubuntu steps: - uses: actions/checkout@v4 diff --git a/src/oryx/devcontainer-feature.json b/src/oryx/devcontainer-feature.json index 39b9a7103..1a3ee1b2f 100644 --- a/src/oryx/devcontainer-feature.json +++ b/src/oryx/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "oryx", - "version": "1.3.6", + "version": "1.3.7", "name": "Oryx", "description": "Installs the oryx CLI", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/oryx", diff --git a/src/oryx/install.sh b/src/oryx/install.sh index 6c193f863..cf67db6b1 100755 --- a/src/oryx/install.sh +++ b/src/oryx/install.sh @@ -149,6 +149,7 @@ DOTNET_BINARY="" if dotnet --version > /dev/null ; then DOTNET_BINARY=$(which dotnet) + RUNTIME_VERSIONS=$(dotnet --list-runtimes | awk '{print $2}' | sort | uniq) fi MAJOR_VERSION_ID=$(echo $(dotnet --version) | cut -d . -f 1) @@ -156,20 +157,17 @@ PATCH_VERSION_ID=$(echo $(dotnet --version) | cut -d . -f 3) PINNED_SDK_VERSION="" # Oryx needs to be built with .NET 8 -if [[ "${DOTNET_BINARY}" = "" ]] || [[ $MAJOR_VERSION_ID != "8" ]] || [[ $MAJOR_VERSION_ID = "8" && ${PATCH_VERSION_ID} -ge "101" ]] ; then +if [[ "${DOTNET_BINARY}" = "" ]] || [[ $MAJOR_VERSION_ID != "8" ]] || [[ $MAJOR_VERSION_ID = "8" && ${PATCH_VERSION_ID} -ne "202" ]] ; then echo "'dotnet 8' was not detected. Attempting to install .NET 8 to build oryx." - # The oryx build fails with .Net 8.0.201, see https://github.com/devcontainers/images/issues/974 # Pinning it to a working version until the upstream Oryx repo updates the dependency # install_dotnet_using_apt - PINNED_SDK_VERSION="8.0.101" + PINNED_SDK_VERSION="8.0.202" install_dotnet_with_script ${PINNED_SDK_VERSION} - if ! dotnet --version > /dev/null ; then echo "(!) Please install Dotnet before installing Oryx" exit 1 fi - fi BUILD_SCRIPT_GENERATOR=/usr/local/buildscriptgen @@ -192,8 +190,8 @@ echo "Building solution '$SOLUTION_FILE_NAME'..." cd $GIT_ORYX ${DOTNET_BINARY} build "$SOLUTION_FILE_NAME" -c Debug -${DOTNET_BINARY} publish -property:ValidateExecutableReferencesMatchSelfContained=false -r linux-x64 -o ${BUILD_SCRIPT_GENERATOR} -c Release $GIT_ORYX/src/BuildScriptGeneratorCli/BuildScriptGeneratorCli.csproj -${DOTNET_BINARY} publish -r linux-x64 -o ${BUILD_SCRIPT_GENERATOR} -c Release $GIT_ORYX/src/BuildServer/BuildServer.csproj +${DOTNET_BINARY} publish -property:ValidateExecutableReferencesMatchSelfContained=false -r linux-x64 -o ${BUILD_SCRIPT_GENERATOR} -c Release $GIT_ORYX/src/BuildScriptGeneratorCli/BuildScriptGeneratorCli.csproj --self-contained true +${DOTNET_BINARY} publish -r linux-x64 -o ${BUILD_SCRIPT_GENERATOR} -c Release $GIT_ORYX/src/BuildServer/BuildServer.csproj --self-contained true chmod a+x ${BUILD_SCRIPT_GENERATOR}/GenerateBuildScript @@ -236,16 +234,19 @@ fi if [[ "${PINNED_SDK_VERSION}" != "" ]]; then rm -f ${GIT_ORYX}/global.json rm -rf /usr/share/dotnet/sdk/$PINNED_SDK_VERSION - - # Extract the major, minor version and the first digit of the patch version - MAJOR_MINOR_PATCH1_VERSION=${PINNED_SDK_VERSION%??} - rm -rf /usr/share/dotnet/shared/Microsoft.NETCore.App/$MAJOR_MINOR_PATCH1_VERSION - rm -rf /usr/share/dotnet/shared/Microsoft.AspNetCore.App/$MAJOR_MINOR_PATCH1_VERSION - rm -rf /usr/share/dotnet/templates/$MAJOR_MINOR_PATCH1_VERSION + NEW_RUNTIME_VERSIONS=$(dotnet --list-runtimes | awk '{print $2}' | sort | uniq) + if [ -n "${RUNTIME_VERSIONS:-}" ]; then + SDK_INSTALLED_RUNTIME=$(echo "$NEW_RUNTIME_VERSIONS" | grep -vxFf <(echo "$RUNTIME_VERSIONS")) + else + SDK_INSTALLED_RUNTIME="$NEW_RUNTIME_VERSIONS" + fi + rm -rf /usr/share/dotnet/shared/Microsoft.NETCore.App/$SDK_INSTALLED_RUNTIME + rm -rf /usr/share/dotnet/shared/Microsoft.AspNetCore.App/$SDK_INSTALLED_RUNTIME + rm -rf /usr/share/dotnet/templates/$SDK_INSTALLED_RUNTIME fi # Clean up rm -rf /var/lib/apt/lists/* -echo "Done!" +echo "Done!" \ No newline at end of file diff --git a/src/python/devcontainer-feature.json b/src/python/devcontainer-feature.json index 64b02fd34..64976fc63 100644 --- a/src/python/devcontainer-feature.json +++ b/src/python/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "python", - "version": "1.6.5", + "version": "1.7.0", "name": "Python", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/python", "description": "Installs the provided version of Python, as well as PIPX, and other common Python utilities. JupyterLab is conditionally installed with the python feature. Note: May require source code compilation.", @@ -67,7 +67,7 @@ "PYTHON_PATH": "/usr/local/python/current", "PIPX_HOME": "/usr/local/py-utils", "PIPX_BIN_DIR": "/usr/local/py-utils/bin", - "PATH": "/usr/local/python/current/bin:/usr/local/py-utils/bin:${PATH}" + "PATH": "/usr/local/python/current/bin:/usr/local/py-utils/bin:/usr/local/jupyter:${PATH}" }, "customizations": { "vscode": { @@ -78,9 +78,9 @@ ], "settings": { "python.defaultInterpreterPath": "/usr/local/python/current/bin/python", - "[python]": { - "editor.defaultFormatter": "ms-python.autopep8" - } + "[python]": { + "editor.defaultFormatter": "ms-python.autopep8" + } } } }, @@ -88,4 +88,4 @@ "ghcr.io/devcontainers/features/common-utils", "ghcr.io/devcontainers/features/oryx" ] -} +} \ No newline at end of file diff --git a/src/python/install.sh b/src/python/install.sh index ead55cc8a..b3311c7c6 100755 --- a/src/python/install.sh +++ b/src/python/install.sh @@ -912,21 +912,15 @@ if [ "${INSTALL_JUPYTERLAB}" = "true" ]; then install_user_package $INSTALL_UNDER_ROOT jupyterlab install_user_package $INSTALL_UNDER_ROOT jupyterlab-git + # Create a symlink to the JupyterLab binary for non root users if [ "$INSTALL_UNDER_ROOT" = false ]; then - # JupyterLab would have installed into /home/${USERNAME}/.local/bin - # Adding it to default path for Codespaces which use non-login shells - SUDOERS_FILE="/etc/sudoers.d/$USERNAME" - SEARCH_STR="Defaults secure_path=" - REPLACE_STR="Defaults secure_path=/home/${USERNAME}/.local/bin" - - if grep -qs ${SEARCH_STR} ${SUDOERS_FILE}; then - # string found and file is present - sed -i "s|${SEARCH_STR}|${REPLACE_STR}:|g" "${SUDOERS_FILE}" - else - # either string is not found, or file is not present - # In either case take same action, note >> places at end of file - echo "${REPLACE_STR}:${PATH}" >> ${SUDOERS_FILE} + JUPYTER_INPATH=/home/${USERNAME}/.local/bin + if [ ! -d "$JUPYTER_INPATH" ]; then + echo "Error: $JUPYTER_INPATH does not exist." + exit 1 fi + JUPYTER_PATH=/usr/local/jupyter + ln -s "$JUPYTER_INPATH" "$JUPYTER_PATH" fi # Configure JupyterLab if needed diff --git a/test/python/install_jupyterlab.sh b/test/python/install_jupyterlab.sh index 033b44edd..255b4e896 100755 --- a/test/python/install_jupyterlab.sh +++ b/test/python/install_jupyterlab.sh @@ -22,8 +22,8 @@ check "jupyterlab_git" grep jupyterlab_git <<< "$packages" # Check for correct JupyterLab configuration check "config" grep ".*.allow_origin = '*'" /home/vscode/.jupyter/jupyter_server_config.py -# Check for PATH modification -check "default path has jupyterlab" sudo grep "/home/${user}/.local/bin" /etc/sudoers.d/$user +#check "default path has jupyterlab symlink" +check "default path has jupyterlab" test -L "/usr/local/jupyter" # Report result reportResults diff --git a/test/python/install_jupyterlab_existing_sudoers_file/Dockerfile b/test/python/install_jupyterlab_existing_sudoers_file/Dockerfile deleted file mode 100644 index 5acb58a37..000000000 --- a/test/python/install_jupyterlab_existing_sudoers_file/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -# Builds an image with a preconfigured SUDOERS file -# Used to test the install script for JupyterLab which modifies this file -FROM mcr.microsoft.com/devcontainers/base:focal - -COPY --chown=root sudoers.test /etc/sudoers.d/vscode diff --git a/test/python/install_jupyterlab_existing_sudoers_file/sudoers.test b/test/python/install_jupyterlab_existing_sudoers_file/sudoers.test deleted file mode 100644 index 9a26d777b..000000000 --- a/test/python/install_jupyterlab_existing_sudoers_file/sudoers.test +++ /dev/null @@ -1,2 +0,0 @@ -# Sudoers File for testing, after install script runs the Defaults secure_path should be appended to -Defaults secure_path=/original_content_of_sudoers_file \ No newline at end of file diff --git a/test/python/scenarios.json b/test/python/scenarios.json index e4fe0f0cd..be37869df 100644 --- a/test/python/scenarios.json +++ b/test/python/scenarios.json @@ -68,19 +68,6 @@ } } }, - "install_jupyterlab_existing_sudoers_file": { - "build": { - "dockerfile": "Dockerfile" - }, - "remoteUser": "vscode", - "features": { - "python": { - "version": "latest", - "installJupyterlab": true, - "configureJupyterlabAllowOrigin": "*" - } - } - }, "install_jupyterlab_rhel_family": { "image": "almalinux:8", "remoteUser": "vscode",